diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-20 14:37:12 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-04-02 21:12:57 (GMT) |
commit | 5de63265e3a22d9a8aa5ad437a5030ccfcbcd02d (patch) | |
tree | 558694f9724c696198c6be2faff1a06f98fe6de6 /Tests | |
parent | aa0a3562dd47bdd6d9ca3058bd1dfd525e79d36d (diff) | |
download | CMake-5de63265e3a22d9a8aa5ad437a5030ccfcbcd02d.zip CMake-5de63265e3a22d9a8aa5ad437a5030ccfcbcd02d.tar.gz CMake-5de63265e3a22d9a8aa5ad437a5030ccfcbcd02d.tar.bz2 |
Genex: Only evaluate TARGET_OBJECTS to determine target sources.
The output of this expression may contain macros for IDEs to replace
such as $(Configuration), $(CURRENT_ARCH) etc. To avoid generating
content which is not usable in other contexts, report an error if
there is an attempt to use it in other contexts.
This commit may be reverted in the future if a solution to the
above difference is implemented.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/GeneratorExpression/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/GeneratorExpression/check_object_files.cmake | 48 | ||||
-rw-r--r-- | Tests/GeneratorExpression/objlib1.c | 5 | ||||
-rw-r--r-- | Tests/GeneratorExpression/objlib2.c | 5 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/BadContext-result.txt (renamed from Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/BadContext-stderr.txt | 17 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/BadContext.cmake (renamed from Tests/RunCMake/TargetObjects/NoTarget.cmake) | 2 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/NoTarget-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/NoTarget-stderr.txt | 8 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt | 8 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/RunCMakeTest.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/TargetObjects/empty.cpp | 7 |
13 files changed, 20 insertions, 102 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index b506853..758165c 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -258,17 +258,3 @@ set(CMP0044_TYPE NEW) add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW) set(CMP0044_TYPE OLD) add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD) - -add_library(objlib OBJECT objlib1.c objlib2.c) -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/objlib_files" - CONTENT "$<JOIN:$<TARGET_OBJECTS:objlib>,\n>\n" -) -add_custom_target(check_object_files ALL - COMMAND ${CMAKE_COMMAND} - "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/objlib_files" - -DTEST_CONFIGURATION=${CMAKE_BUILD_TYPE} - -DEXPECTED_NUM_OBJECTFILES=2 - -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" - DEPENDS objlib -) diff --git a/Tests/GeneratorExpression/check_object_files.cmake b/Tests/GeneratorExpression/check_object_files.cmake deleted file mode 100644 index 889fe80..0000000 --- a/Tests/GeneratorExpression/check_object_files.cmake +++ /dev/null @@ -1,48 +0,0 @@ - -if (NOT EXISTS ${OBJLIB_LISTFILE}) - message(SEND_ERROR "Object listing file \"${OBJLIB_LISTFILE}\" not found!") -endif() - -file(STRINGS ${OBJLIB_LISTFILE} objlib_files) - -list(LENGTH objlib_files num_objectfiles) -if (NOT EXPECTED_NUM_OBJECTFILES EQUAL num_objectfiles) - message(SEND_ERROR "Unexpected number of entries in object list file (${num_objectfiles} instead of ${EXPECTED_NUM_OBJECTFILES})") -endif() - -foreach(objlib_file ${objlib_files}) - set(file_exists False) - if (EXISTS ${objlib_file}) - set(file_exists True) - endif() - - if (NOT file_exists) - if (objlib_file MATCHES ".(CURRENT_ARCH)") - string(REPLACE "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" "*" config_file "${objlib_file}") - string(REPLACE "$(PROJECT_NAME)" "GeneratorExpression" config_file "${config_file}") - string(REPLACE "$(CURRENT_ARCH)" "*" config_file "${config_file}") - file(GLOB_RECURSE files "${config_file}") - list(LENGTH files num_files) - if (NOT files) - message(SEND_ERROR "Got no files for expression ${config_file}") - endif() - set(file_exists True) - else() - foreach(config_macro "$(Configuration)" "$(OutDir)" "$(IntDir)") - string(REPLACE "${config_macro}" "${TEST_CONFIGURATION}" config_file "${objlib_file}") - list(APPEND attempts ${config_file}) - if (EXISTS ${config_file}) - set(file_exists True) - endif() - endforeach() - endif() - endif() - - if (NOT file_exists) - if(attempts) - list(REMOVE_DUPLICATES attempts) - set(tried " Tried ${attempts}") - endif() - message(SEND_ERROR "File \"${objlib_file}\" does not exist!${tried}") - endif() -endforeach() diff --git a/Tests/GeneratorExpression/objlib1.c b/Tests/GeneratorExpression/objlib1.c deleted file mode 100644 index aa8de0a..0000000 --- a/Tests/GeneratorExpression/objlib1.c +++ /dev/null @@ -1,5 +0,0 @@ - -void objlib1() -{ - -} diff --git a/Tests/GeneratorExpression/objlib2.c b/Tests/GeneratorExpression/objlib2.c deleted file mode 100644 index 3c7307a..0000000 --- a/Tests/GeneratorExpression/objlib2.c +++ /dev/null @@ -1,5 +0,0 @@ - -void objlib2() -{ - -} diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt b/Tests/RunCMake/TargetObjects/BadContext-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt +++ b/Tests/RunCMake/TargetObjects/BadContext-result.txt diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt new file mode 100644 index 0000000..92f2c91 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadContext.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NoTarget> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error: + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NoTarget> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. diff --git a/Tests/RunCMake/TargetObjects/NoTarget.cmake b/Tests/RunCMake/TargetObjects/BadContext.cmake index f203c23..67962a4 100644 --- a/Tests/RunCMake/TargetObjects/NoTarget.cmake +++ b/Tests/RunCMake/TargetObjects/BadContext.cmake @@ -1,2 +1,4 @@ file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:NoTarget>) + +install(FILES $<TARGET_OBJECTS:NoTarget> DESTINATION objects) diff --git a/Tests/RunCMake/TargetObjects/NoTarget-result.txt b/Tests/RunCMake/TargetObjects/NoTarget-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/TargetObjects/NoTarget-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt deleted file mode 100644 index 2c4f877..0000000 --- a/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at NoTarget.cmake:2 \(file\): - Error evaluating generator expression: - - \$<TARGET_OBJECTS:NoTarget> - - Objects of target "NoTarget" referenced but no such target exists. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt deleted file mode 100644 index bb83934..0000000 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at NotObjlibTarget.cmake:4 \(file\): - Error evaluating generator expression: - - \$<TARGET_OBJECTS:StaticLib> - - Objects of target "StaticLib" referenced but is not an OBJECT library. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake deleted file mode 100644 index c7f8a71..0000000 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -add_library(StaticLib empty.cpp) - -file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:StaticLib>) diff --git a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake index 30b9fee..85c76e2 100644 --- a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake @@ -1,4 +1,3 @@ include(RunCMake) -run_cmake(NoTarget) -run_cmake(NotObjlibTarget) +run_cmake(BadContext) diff --git a/Tests/RunCMake/TargetObjects/empty.cpp b/Tests/RunCMake/TargetObjects/empty.cpp deleted file mode 100644 index bfbbdde..0000000 --- a/Tests/RunCMake/TargetObjects/empty.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int empty() -{ - return 0; -} |