From 5838aba1aae5c341941c0779cd947ed0172e3a61 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 26 Nov 2013 11:24:47 +0100 Subject: [PATCH] Export: Report error on relative include with genex. Diagnostics which check the sanity of exported include paths previously skipped over any path containing a generator expression. Introduce a policy to issue an error message in such cases. The export files created in the OLD behavior are not usable, because they contain relative paths or paths to the source or build location which are not suitable for use on installation. CMake will report an error on import. --- Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0041.rst | 25 +++++++++++ Source/cmExportFileGenerator.cxx | 42 ++++++++++++------- Source/cmPolicies.cxx | 5 +++ Source/cmPolicies.h | 1 + Source/cmTarget.h | 3 +- Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt | 1 + Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt | 20 +++++++++ Tests/RunCMake/CMP0041/CMP0041-NEW.cmake | 12 ++++++ Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt | 1 + Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt | 1 + Tests/RunCMake/CMP0041/CMP0041-OLD.cmake | 12 ++++++ .../RunCMake/CMP0041/CMP0041-WARN-result.txt | 1 + .../RunCMake/CMP0041/CMP0041-WARN-stderr.txt | 32 ++++++++++++++ Tests/RunCMake/CMP0041/CMP0041-WARN.cmake | 10 +++++ .../CMP0041/CMP0041-tid-NEW-result.txt | 1 + .../CMP0041/CMP0041-tid-NEW-stderr.txt | 22 ++++++++++ Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake | 11 +++++ .../CMP0041/CMP0041-tid-OLD-result.txt | 1 + .../CMP0041/CMP0041-tid-OLD-stderr.txt | 1 + Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake | 11 +++++ .../CMP0041/CMP0041-tid-WARN-result.txt | 1 + .../CMP0041/CMP0041-tid-WARN-stderr.txt | 34 +++++++++++++++ Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake | 9 ++++ Tests/RunCMake/CMP0041/CMakeLists.txt | 3 ++ Tests/RunCMake/CMP0041/RunCMakeTest.cmake | 8 ++++ Tests/RunCMake/CMP0041/empty.cpp | 7 ++++ Tests/RunCMake/CMakeLists.txt | 1 + 28 files changed, 262 insertions(+), 15 deletions(-) create mode 100644 Help/policy/CMP0041.rst create mode 100644 Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-NEW.cmake create mode 100644 Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-OLD.cmake create mode 100644 Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-WARN.cmake create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-NEW-result.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake create mode 100644 Tests/RunCMake/CMP0041/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0041/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CMP0041/empty.cpp diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index e954a86fc..5e94f891c 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -74,3 +74,4 @@ All Policies /policy/CMP0038 /policy/CMP0039 /policy/CMP0040 + /policy/CMP0041 diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst new file mode 100644 index 000000000..acb85af56 --- /dev/null +++ b/Help/policy/CMP0041.rst @@ -0,0 +1,25 @@ +CMP0041 +------- + +Error on relative include with generator expression. + +Diagnostics in CMake 2.8.12 and lower silently ignored an entry in the +:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a target if it contained a generator +expression at any position. + +The path entries in that target property should not be relative. High-level +API should ensure that by adding either a source directory or a install +directory prefix, as appropriate. + +As an additional diagnostic, the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` generated +on an :prop_tgt:`IMPORTED` target for the install location should not contain +paths in the source directory or the build directory. + +The OLD behavior for this policy is to ignore relative path entries if they +contain a generator expression. The NEW behavior for this policy is to report +an error if a generator expression appears in another location and the path is +relative. + +This policy was introduced in CMake version 3.0.0. CMake version +|release| warns when the policy is not set and uses OLD behavior. Use +the cmake_policy command to set it to OLD or NEW explicitly. diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9186ab67d..2d963fecf 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -233,26 +233,46 @@ static bool checkInterfaceDirs(const std::string &prepro, const bool inSourceBuild = strcmp(topSourceDir, topBinaryDir) == 0; + bool hadFatalError = false; + for(std::vector::iterator li = parts.begin(); li != parts.end(); ++li) { - if (cmGeneratorExpression::Find(*li) != std::string::npos) + size_t genexPos = cmGeneratorExpression::Find(*li); + if (genexPos == 0) { continue; } + cmake::MessageType messageType = cmake::FATAL_ERROR; + cmOStringStream e; + if (genexPos != std::string::npos) + { + switch (target->GetPolicyStatusCMP0041()) + { + case cmPolicies::WARN: + messageType = cmake::WARNING; + e << target->GetMakefile()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0041) << "\n"; + break; + case cmPolicies::OLD: + continue; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + hadFatalError = true; + break; // Issue fatal message. + } + } if (cmHasLiteralPrefix(li->c_str(), "${_IMPORT_PREFIX}")) { continue; } if (!cmSystemTools::FileIsFullPath(li->c_str())) { - cmOStringStream e; e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n" " \"" << *li << "\""; - target->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, - e.str().c_str()); - return false; + target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); } if (isSubDirectory(li->c_str(), installDir)) { @@ -260,29 +280,23 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (isSubDirectory(li->c_str(), topBinaryDir)) { - cmOStringStream e; e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the build directory."; - target->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, - e.str().c_str()); - return false; + target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); } if (!inSourceBuild) { if (isSubDirectory(li->c_str(), topSourceDir)) { - cmOStringStream e; e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the source directory."; - target->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, - e.str().c_str()); - return false; + target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); } } } - return true; + return !hadFatalError; } //---------------------------------------------------------------------------- diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index b9b469c56..0b3018eb6 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -306,6 +306,11 @@ cmPolicies::cmPolicies() CMP0040, "CMP0040", "The target in the TARGET signature of add_custom_command() must exist.", 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0041, "CMP0041", + "Error on relative include with generator expression.", + 3,0,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 683412169..245ec4b1d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -94,6 +94,7 @@ public: CMP0039, ///< Utility targets may not have link dependencies CMP0040, ///< The target in the TARGET signature of /// add_custom_command() must exist. + CMP0041, ///< Error on relative include with generator expression /** \brief Always the last entry. * diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 35ec68003..7a40d70ca 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -25,7 +25,8 @@ F(CMP0008) \ F(CMP0020) \ F(CMP0021) \ - F(CMP0022) + F(CMP0022) \ + F(CMP0041) class cmake; class cmMakefile; diff --git a/Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt b/Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt new file mode 100644 index 000000000..2ec3aef20 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-NEW-stderr.txt @@ -0,0 +1,20 @@ +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains relative path: + + "include/\$" + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$" + + which is prefixed in the source directory. + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-NEW-build/include/\$" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-NEW.cmake b/Tests/RunCMake/CMP0041/CMP0041-NEW.cmake new file mode 100644 index 000000000..605b79a00 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-NEW.cmake @@ -0,0 +1,12 @@ + +cmake_policy(SET CMP0041 NEW) + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY INTERFACE_INCLUDE_DIRECTORIES + include/$ + ${CMAKE_CURRENT_SOURCE_DIR}/include/$ + ${CMAKE_CURRENT_BINARY_DIR}/include/$ +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt new file mode 100644 index 000000000..10f32932e --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake b/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake new file mode 100644 index 000000000..16cbced52 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-OLD.cmake @@ -0,0 +1,12 @@ + +cmake_policy(SET CMP0041 OLD) + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY INTERFACE_INCLUDE_DIRECTORIES + include/$ + ${CMAKE_CURRENT_SOURCE_DIR}/include/$ + ${CMAKE_CURRENT_BINARY_DIR}/include/$ +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt b/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt new file mode 100644 index 000000000..a7d303e4d --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-WARN-stderr.txt @@ -0,0 +1,32 @@ +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains relative path: + + "include/\$" + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$" + + which is prefixed in the source directory. + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-WARN-build/include/\$" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake b/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake new file mode 100644 index 000000000..873cbc708 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-WARN.cmake @@ -0,0 +1,10 @@ + +add_library(foo empty.cpp) +set_property(TARGET foo + PROPERTY INTERFACE_INCLUDE_DIRECTORIES + include/$ + ${CMAKE_CURRENT_SOURCE_DIR}/include/$ + ${CMAKE_CURRENT_BINARY_DIR}/include/$ +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-stderr.txt new file mode 100644 index 000000000..9b0a21431 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-stderr.txt @@ -0,0 +1,22 @@ +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$" + + which is prefixed in the source directory. + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$" + + which is prefixed in the source directory. + + +CMake Error in CMakeLists.txt: + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-tid-NEW-build/include/\$" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake new file mode 100644 index 000000000..3005108aa --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-NEW.cmake @@ -0,0 +1,11 @@ + +cmake_policy(SET CMP0041 NEW) + +add_library(foo empty.cpp) +target_include_directories(foo INTERFACE + include/$ + ${CMAKE_CURRENT_SOURCE_DIR}/include/$ + ${CMAKE_CURRENT_BINARY_DIR}/include/$ +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt new file mode 100644 index 000000000..10f32932e --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake new file mode 100644 index 000000000..b5c4e7f85 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD.cmake @@ -0,0 +1,11 @@ + +cmake_policy(SET CMP0041 OLD) + +add_library(foo empty.cpp) +target_include_directories(foo INTERFACE + include/$ + ${CMAKE_CURRENT_SOURCE_DIR}/include/$ + ${CMAKE_CURRENT_BINARY_DIR}/include/$ +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt new file mode 100644 index 000000000..aae2c7a17 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-stderr.txt @@ -0,0 +1,34 @@ +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$" + + which is prefixed in the source directory. + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/include/\$" + + which is prefixed in the source directory. + + +CMake Warning in CMakeLists.txt: + Policy CMP0041 is not set: Error on relative include with generator + expression. Run "cmake --help-policy CMP0041" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "foo" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*/Tests/RunCMake/CMP0041/CMP0041-tid-WARN-build/include/\$" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake new file mode 100644 index 000000000..ee4c2a621 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-WARN.cmake @@ -0,0 +1,9 @@ + +add_library(foo empty.cpp) +target_include_directories(foo INTERFACE + include/$ + ${CMAKE_CURRENT_SOURCE_DIR}/include/$ + ${CMAKE_CURRENT_BINARY_DIR}/include/$ +) +install(TARGETS foo EXPORT FooExport DESTINATION lib) +install(EXPORT FooExport DESTINATION lib/cmake) diff --git a/Tests/RunCMake/CMP0041/CMakeLists.txt b/Tests/RunCMake/CMP0041/CMakeLists.txt new file mode 100644 index 000000000..11ea636d0 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake new file mode 100644 index 000000000..a5e2114cb --- /dev/null +++ b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMP0041-OLD) +run_cmake(CMP0041-NEW) +run_cmake(CMP0041-WARN) +run_cmake(CMP0041-tid-OLD) +run_cmake(CMP0041-tid-NEW) +run_cmake(CMP0041-tid-WARN) diff --git a/Tests/RunCMake/CMP0041/empty.cpp b/Tests/RunCMake/CMP0041/empty.cpp new file mode 100644 index 000000000..bfbbddeb9 --- /dev/null +++ b/Tests/RunCMake/CMP0041/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 209b0b3b3..72ea95d2f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -60,6 +60,7 @@ add_RunCMake_test(CMP0037) add_RunCMake_test(CMP0038) add_RunCMake_test(CMP0039) add_RunCMake_test(CMP0040) +add_RunCMake_test(CMP0041) add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange)