mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-03 12:19:41 -06:00
The `CMAKE_{EXE,SHARED,MODULE,STATIC}_LINKER_FLAGS` variables are
not language-specific, so multiple languages' toolchains may disagree
about if/how to pass the flag through a compiler driver to the linker.
Furthermore, carrying the flag in public-facing variables allows projects
or users to change it even though it is required. Add policy CMP0197
to remove the flag from the public-facing variables and generate it
automatically instead:
* For command-line generators, add the `-machine:` flag to the
linker and archiver rule variables.
* For Visual Studio generators, we do not need to explicitly add the
link `-machine:` flag. MSBuild automatically adds it, and the new
behavior actually removes a duplicate we generated previously.
Issue: #21934
19 lines
498 B
CMake
19 lines
498 B
CMake
include(RunCMake)
|
|
|
|
run_cmake(CMP0092-WARN)
|
|
run_cmake(CMP0092-OLD)
|
|
run_cmake(CMP0092-NEW)
|
|
|
|
function(run_CMP0197 pol)
|
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0197-${pol})
|
|
run_cmake(CMP0197-${pol})
|
|
set(RunCMake_TEST_NO_CLEAN 1)
|
|
set(RunCMake_TEST_OUTPUT_MERGE 1)
|
|
set(RunCMake-stdout-file "CMP0197-build-stdout.txt")
|
|
run_cmake_command(CMP0197-${pol}-build ${CMAKE_COMMAND} --build . --config Debug --verbose)
|
|
endfunction()
|
|
|
|
run_CMP0197(WARN)
|
|
run_CMP0197(OLD)
|
|
run_CMP0197(NEW)
|