diff options
-rw-r--r-- | Modules/Compiler/TI-C.cmake | 2 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 12 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt | 10 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake | 3 |
5 files changed, 24 insertions, 4 deletions
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index 479666c..ebc79f4 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -7,4 +7,4 @@ set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_fi set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<OBJECT>") set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>") -set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>") +set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5e0d2b7..f435a1d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1131,7 +1131,9 @@ const char* cmTarget::GetProperty(const std::string& prop, // target because the configuration type may not be known at // CMake time. cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); - gg->CreateGenerationObjects(); + if (!gg->GetConfigureDoneCMP0026()) { + gg->CreateGenerationObjects(); + } cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName()); this->Properties.SetProperty(propLOCATION, gt->GetLocationForBuild()); } @@ -1150,7 +1152,9 @@ const char* cmTarget::GetProperty(const std::string& prop, prop, this->ImportedGetFullPath(configName, false).c_str()); } else { cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); - gg->CreateGenerationObjects(); + if (!gg->GetConfigureDoneCMP0026()) { + gg->CreateGenerationObjects(); + } cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName()); this->Properties.SetProperty( prop, gt->GetFullPath(configName, false).c_str()); @@ -1168,7 +1172,9 @@ const char* cmTarget::GetProperty(const std::string& prop, prop, this->ImportedGetFullPath(configName, false).c_str()); } else { cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); - gg->CreateGenerationObjects(); + if (!gg->GetConfigureDoneCMP0026()) { + gg->CreateGenerationObjects(); + } cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName()); this->Properties.SetProperty( prop, gt->GetFullPath(configName, false).c_str()); diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 45175d8..625bab2 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -28,6 +28,7 @@ run_cmake(COMPILE_LANGUAGE-add_test) run_cmake(COMPILE_LANGUAGE-unknown-lang) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) +run_cmake(TARGET_PROPERTY-LOCATION) run_cmake(ImportedTarget-TARGET_PDB_FILE) if(LINKER_SUPPORTS_PDB) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt new file mode 100644 index 0000000..e4dbb71 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property should not be read from target "foo". Use the target + name directly with add_custom_command, or use the generator expression + \$<TARGET_FILE>, as appropriate. + +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake new file mode 100644 index 0000000..8929cdb --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_library(foo empty.c) +add_custom_target(drive COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,LOCATION>) |