summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-12-17 15:07:19 (GMT)
committerBrad King <brad.king@kitware.com>2010-12-17 15:07:19 (GMT)
commit853de2ed1288dbf891778db30653927d0e223a44 (patch)
tree93a53e32c5d60af84c66c76511c103ab9ee52db1 /Tests
parentd89e238e6c4b22fe3fde0f8e1e7987fb05f13aeb (diff)
parent45e1953c4037d4492668651ae3bbfd6a4a875bc1 (diff)
downloadCMake-853de2ed1288dbf891778db30653927d0e223a44.zip
CMake-853de2ed1288dbf891778db30653927d0e223a44.tar.gz
CMake-853de2ed1288dbf891778db30653927d0e223a44.tar.bz2
Merge branch 'custom-command-generator-expressions' into resolve/tests-if-CYGWIN
The tests-if-CYGWIN topic made a change to Tests/Testing/CMakeLists.txt in code that the custom-command-generator-expressions topic moved to the Tests/PerConfig/CMakeLists.txt file. Make the same change to the same content in the new file. (Only a small part of the file moved so rename detection did not do this automatically.)
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt5
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt50
-rw-r--r--Tests/PerConfig/CMakeLists.txt33
-rw-r--r--Tests/PerConfig/pcShared.c (renamed from Tests/Testing/pcShared.c)0
-rw-r--r--Tests/PerConfig/pcShared.h (renamed from Tests/Testing/pcShared.h)0
-rw-r--r--Tests/PerConfig/pcStatic.c (renamed from Tests/Testing/pcStatic.c)0
-rw-r--r--Tests/PerConfig/perconfig.c (renamed from Tests/Testing/perconfig.c)0
-rw-r--r--Tests/PerConfig/perconfig.cmake (renamed from Tests/Testing/driver.cmake)0
-rw-r--r--Tests/Testing/CMakeLists.txt34
9 files changed, 82 insertions, 40 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 76208d4..746c9a7 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -130,6 +130,7 @@ ADD_CUSTOM_COMMAND(
################################################################
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.pre
DEPENDS ${PROJECT_SOURCE_DIR}/foo.in
+ TDocument # Ensure doc1.h generates before this target
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${PROJECT_SOURCE_DIR}/foo.in
${PROJECT_BINARY_DIR}/foo.pre
@@ -181,10 +182,6 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader)
-# must add a dependency on TDocument otherwise it might never build and
-# the CustomCommand executable really needs doc1.h
-ADD_DEPENDENCIES(CustomCommand TDocument)
-
##############################################################################
# Test for using just the target name as executable in the COMMAND
# section. Has to be recognized and replaced by CMake with the output
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 0828343..e65e362 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -75,24 +75,64 @@ foreach(c DEBUG RELWITHDEBINFO)
set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
endforeach(c)
+#-----------------------------------------------------------------------------
# Create a custom target to generate a header for the libraries below.
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# Drive the header generation through an indirect chain of imported
+# target dependencies.
+
+# testLib2tmp1.h
add_custom_command(
- OUTPUT testLib2.h
+ OUTPUT testLib2tmp1.h
VERBATIM COMMAND
- ${CMAKE_COMMAND} -E echo "extern int testLib2(void);" > testLib2.h
+ ${CMAKE_COMMAND} -E echo "extern int testLib2(void);" > testLib2tmp1.h
+ )
+
+# hdr_testLib2tmp1 needs testLib2tmp1.h
+add_custom_target(hdr_testLib2tmp1 DEPENDS testLib2tmp1.h)
+
+# exp_testExe2 needs hdr_testLib2tmp1
+add_dependencies(exp_testExe2 hdr_testLib2tmp1)
+
+# testLib2tmp.h needs exp_testExe2
+add_custom_command(
+ OUTPUT testLib2tmp.h
+ VERBATIM COMMAND exp_testExe2
+ COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp1.h testLib2tmp.h
)
+
+# hdr_testLib2tmp needs testLib2tmp.h
+add_custom_target(hdr_testLib2tmp DEPENDS testLib2tmp.h)
+
+add_library(dep_testLib2tmp UNKNOWN IMPORTED)
+set_property(TARGET dep_testLib2tmp PROPERTY
+ IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/testLib2tmp.h)
+
+# dep_testLib2tmp needs hdr_testLib2tmp
+add_dependencies(dep_testLib2tmp hdr_testLib2tmp)
+
+# testLib2.h needs dep_testLib2tmp
+add_custom_command(
+ OUTPUT testLib2.h
+ VERBATIM COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp.h testLib2.h
+ DEPENDS dep_testLib2tmp
+ )
+
+# hdr_testLib2 needs testLib2.h
add_custom_target(hdr_testLib2 DEPENDS testLib2.h)
-# Drive the header generation through an indirect chain of imported
-# target dependencies.
add_library(dep_testLib2 UNKNOWN IMPORTED)
+
+# dep_testLib2 needs hdr_testLib2
add_dependencies(dep_testLib2 hdr_testLib2)
+
+# exp_testLib2 and bld_testLib2 both need dep_testLib2
add_dependencies(bld_testLib2 dep_testLib2)
add_dependencies(exp_testLib2 dep_testLib2)
+#-----------------------------------------------------------------------------
# Create a library to be linked by another directory in this project
# to test transitive linking to otherwise invisible imported targets.
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library(imp_lib1 STATIC imp_lib1.c)
target_link_libraries(imp_lib1 exp_testLib2)
add_library(imp_lib1b STATIC imp_lib1.c)
diff --git a/Tests/PerConfig/CMakeLists.txt b/Tests/PerConfig/CMakeLists.txt
new file mode 100644
index 0000000..2a55d33
--- /dev/null
+++ b/Tests/PerConfig/CMakeLists.txt
@@ -0,0 +1,33 @@
+project(PerConfig C)
+
+# Targets with per-configuration names.
+ADD_LIBRARY(pcStatic STATIC pcStatic.c)
+SET_PROPERTY(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt)
+SET_PROPERTY(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg)
+ADD_LIBRARY(pcShared SHARED pcShared.c)
+SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt)
+SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg)
+SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2)
+SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3)
+IF(UNIX AND NOT CYGWIN)
+ SET(soname_file -DpcShared_soname_file=$<TARGET_SONAME_FILE:pcShared>)
+ENDIF()
+ADD_EXECUTABLE(perconfig perconfig.c)
+TARGET_LINK_LIBRARIES(perconfig pcStatic pcShared)
+SET_PROPERTY(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt)
+SET_PROPERTY(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg)
+
+SET(PerConfig_COMMAND
+ ${CMAKE_COMMAND}
+ -Dconfiguration=$<CONFIGURATION>
+ -Dperconfig_file_dir=$<TARGET_FILE_DIR:perconfig>
+ -Dperconfig_file_name=$<TARGET_FILE_NAME:perconfig>
+ -Dperconfig_file=$<TARGET_FILE:perconfig>
+ -DpcStatic_file=$<TARGET_FILE:pcStatic>
+ -DpcStatic_linker_file=$<TARGET_LINKER_FILE:pcStatic>
+ -DpcShared_file=$<TARGET_FILE:pcShared>
+ -DpcShared_linker_file=$<TARGET_LINKER_FILE:pcShared>
+ ${soname_file}
+ -P ${PerConfig_SOURCE_DIR}/perconfig.cmake
+ )
+SET(PerConfig_COMMAND "${PerConfig_COMMAND}" PARENT_SCOPE)
diff --git a/Tests/Testing/pcShared.c b/Tests/PerConfig/pcShared.c
index b08fadc..b08fadc 100644
--- a/Tests/Testing/pcShared.c
+++ b/Tests/PerConfig/pcShared.c
diff --git a/Tests/Testing/pcShared.h b/Tests/PerConfig/pcShared.h
index 59a6ef4..59a6ef4 100644
--- a/Tests/Testing/pcShared.h
+++ b/Tests/PerConfig/pcShared.h
diff --git a/Tests/Testing/pcStatic.c b/Tests/PerConfig/pcStatic.c
index 7e1bf51..7e1bf51 100644
--- a/Tests/Testing/pcStatic.c
+++ b/Tests/PerConfig/pcStatic.c
diff --git a/Tests/Testing/perconfig.c b/Tests/PerConfig/perconfig.c
index d942d45..d942d45 100644
--- a/Tests/Testing/perconfig.c
+++ b/Tests/PerConfig/perconfig.c
diff --git a/Tests/Testing/driver.cmake b/Tests/PerConfig/perconfig.cmake
index 4a93acc..4a93acc 100644
--- a/Tests/Testing/driver.cmake
+++ b/Tests/PerConfig/perconfig.cmake
diff --git a/Tests/Testing/CMakeLists.txt b/Tests/Testing/CMakeLists.txt
index 9e7a637..815b52b 100644
--- a/Tests/Testing/CMakeLists.txt
+++ b/Tests/Testing/CMakeLists.txt
@@ -53,35 +53,7 @@ ADD_TEST(testing.1 ${Testing_BINARY_DIR}/bin/testing)
#
ADD_SUBDIRECTORY(Sub/Sub2)
-# Per-config target name test.
-ADD_LIBRARY(pcStatic STATIC pcStatic.c)
-SET_PROPERTY(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt)
-SET_PROPERTY(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg)
-ADD_LIBRARY(pcShared SHARED pcShared.c)
-SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt)
-SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg)
-SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2)
-SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3)
-IF(UNIX AND NOT CYGWIN)
- SET(soname_file -DpcShared_soname_file=$<TARGET_SONAME_FILE:pcShared>)
-ENDIF()
-ADD_EXECUTABLE(perconfig perconfig.c)
-TARGET_LINK_LIBRARIES(perconfig pcStatic pcShared)
-SET_PROPERTY(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt)
-SET_PROPERTY(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg)
+# Per-config target name and generator expressions.
+ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig)
ADD_TEST(NAME testing.perconfig COMMAND perconfig)
-
-# Test using a driver script with generator expressions.
-ADD_TEST(NAME testing.driver
- COMMAND ${CMAKE_COMMAND}
- -Dconfiguration=$<CONFIGURATION>
- -Dperconfig_file_dir=$<TARGET_FILE_DIR:perconfig>
- -Dperconfig_file_name=$<TARGET_FILE_NAME:perconfig>
- -Dperconfig_file=$<TARGET_FILE:perconfig>
- -DpcStatic_file=$<TARGET_FILE:pcStatic>
- -DpcStatic_linker_file=$<TARGET_LINKER_FILE:pcStatic>
- -DpcShared_file=$<TARGET_FILE:pcShared>
- -DpcShared_linker_file=$<TARGET_LINKER_FILE:pcShared>
- ${soname_file}
- -P ${Testing_SOURCE_DIR}/driver.cmake
- )
+ADD_TEST(NAME testing.driver COMMAND ${PerConfig_COMMAND})