From b10f7ac534ef611fcdd6f09e830be6b9c4e28e11 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 15 Nov 2018 16:46:02 +0100 Subject: CMP0083: fix warning message on try_compile Fixes: #18593 --- Help/command/try_compile.rst | 3 ++- Source/cmCoreTryCompile.cxx | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 28caa7c..310ad11 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -127,7 +127,8 @@ default values: If :policy:`CMP0056` is set to ``NEW``, then :variable:`CMAKE_EXE_LINKER_FLAGS` is passed in as well. -The current setting of :policy:`CMP0065` is set in the generated project. +The current settings of :policy:`CMP0065` and :policy:`CMP0083` are set in the +generated project. Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose a build configuration. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 0b50121..f6ec606 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -656,6 +656,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, ? "NEW" : "OLD"); + /* Set the appropriate policy information for PIE link flags */ + fprintf(fout, "cmake_policy(SET CMP0083 %s)\n", + this->Makefile->GetPolicyStatus(cmPolicies::CMP0083) == + cmPolicies::NEW + ? "NEW" + : "OLD"); + if (targetType == cmStateEnums::EXECUTABLE) { /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", -- cgit v0.12