mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Merge topic 'cmp0181-trycompile-policy-order'
5e52f92a2a try_compile: Add support for toolchain files to query CMP0181
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12540
This commit is contained in:
@@ -38,4 +38,8 @@ expand the ``LINKER:`` prefix.
|
|||||||
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
|
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
|
||||||
.. include:: include/STANDARD_ADVICE.rst
|
.. include:: include/STANDARD_ADVICE.rst
|
||||||
|
|
||||||
|
.. versionchanged:: 4.5
|
||||||
|
The policy is now set in :command:`try_compile` test projects early enough
|
||||||
|
to be queried by :variable:`toolchain files <CMAKE_TOOLCHAIN_FILE>`.
|
||||||
|
|
||||||
.. include:: include/DEPRECATED.rst
|
.. include:: include/DEPRECATED.rst
|
||||||
|
|||||||
@@ -687,6 +687,12 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
|||||||
fprintf(fout, "cmake_policy(SET CMP0128 OLD)\n");
|
fprintf(fout, "cmake_policy(SET CMP0128 OLD)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set LINKER: prefix expansion to match outer project.
|
||||||
|
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0181) !=
|
||||||
|
cmPolicies::NEW) {
|
||||||
|
fprintf(fout, "cmake_policy(SET CMP0181 OLD)\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Set MSVC link -machine: policy to match outer project. */
|
/* Set MSVC link -machine: policy to match outer project. */
|
||||||
if (cmValue cmp0197 = this->Makefile->GetDefinition(kCMAKE_MSVC_CMP0197)) {
|
if (cmValue cmp0197 = this->Makefile->GetDefinition(kCMAKE_MSVC_CMP0197)) {
|
||||||
fprintf(fout, "cmake_policy(SET CMP0197 %s)\n",
|
fprintf(fout, "cmake_policy(SET CMP0197 %s)\n",
|
||||||
@@ -907,15 +913,6 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
|||||||
? "OLD"
|
? "OLD"
|
||||||
: "NEW");
|
: "NEW");
|
||||||
|
|
||||||
/* Set the appropriate policy information for the LINKER: prefix
|
|
||||||
* expansion
|
|
||||||
*/
|
|
||||||
fprintf(fout, "cmake_policy(SET CMP0181 %s)\n",
|
|
||||||
this->Makefile->GetPolicyStatus(cmPolicies::CMP0181) ==
|
|
||||||
cmPolicies::NEW
|
|
||||||
? "NEW"
|
|
||||||
: "OLD");
|
|
||||||
|
|
||||||
// Honor CMAKE_EXE_LINKER_FLAGS in Swift if the outer project does.
|
// Honor CMAKE_EXE_LINKER_FLAGS in Swift if the outer project does.
|
||||||
fprintf(fout, "cmake_policy(SET CMP0214 %s)\n",
|
fprintf(fout, "cmake_policy(SET CMP0214 %s)\n",
|
||||||
this->Makefile->GetPolicyStatus(cmPolicies::CMP0214) ==
|
this->Makefile->GetPolicyStatus(cmPolicies::CMP0214) ==
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
^try_compile CMP0181='NEW'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/CMP0181-toolchain.cmake")
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0181 NEW)
|
||||||
|
enable_language(C)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
^try_compile CMP0181='OLD'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/CMP0181-toolchain.cmake")
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0181 OLD)
|
||||||
|
enable_language(C)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
^try_compile CMP0181='OLD'
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/CMP0181-toolchain.cmake")
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# leave CMP0181 unset
|
||||||
|
enable_language(C)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
|
||||||
|
if(_IN_TC)
|
||||||
|
cmake_policy(GET CMP0181 cmp0181)
|
||||||
|
message("try_compile CMP0181='${cmp0181}'")
|
||||||
|
endif()
|
||||||
@@ -14,6 +14,9 @@ run_cmake_toolchain(LinkFlagsInit)
|
|||||||
run_cmake_toolchain(CMP0126-NEW)
|
run_cmake_toolchain(CMP0126-NEW)
|
||||||
run_cmake_toolchain(CMP0126-OLD)
|
run_cmake_toolchain(CMP0126-OLD)
|
||||||
run_cmake_toolchain(CMP0126-WARN)
|
run_cmake_toolchain(CMP0126-WARN)
|
||||||
|
run_cmake_toolchain(CMP0181-NEW)
|
||||||
|
run_cmake_toolchain(CMP0181-OLD)
|
||||||
|
run_cmake_toolchain(CMP0181-WARN)
|
||||||
run_cmake_toolchain(CMP0210-NEW)
|
run_cmake_toolchain(CMP0210-NEW)
|
||||||
run_cmake_toolchain(CMP0210-OLD)
|
run_cmake_toolchain(CMP0210-OLD)
|
||||||
run_cmake_toolchain(CMP0210-WARN)
|
run_cmake_toolchain(CMP0210-WARN)
|
||||||
|
|||||||
Reference in New Issue
Block a user