diff options
author | Brad King <brad.king@kitware.com> | 2009-02-13 20:49:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-02-13 20:49:52 (GMT) |
commit | b44026f74a2cef108eaf0e58f7d13028786ad566 (patch) | |
tree | 022e09d84e5e7f0b1da231f15498288cac97c11c | |
parent | 6d8b207867f3bce0e54bf5136de36603972cd3dc (diff) | |
download | CMake-b44026f74a2cef108eaf0e58f7d13028786ad566.zip CMake-b44026f74a2cef108eaf0e58f7d13028786ad566.tar.gz CMake-b44026f74a2cef108eaf0e58f7d13028786ad566.tar.bz2 |
ENH: Optionally label KWSys targets and tests
This provides an API for parent projects to use to specify values to be
set in the LABELS properties of KWSys libraries, executables, and tests.
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index c72ec4c..871049b 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -122,6 +122,16 @@ ENDIF(KWSYS_STANDALONE) # The project name is that of the specified namespace. PROJECT(${KWSYS_NAMESPACE}) +# Some properties we set only with CMake 2.6 and above. +IF(COMMAND SET_PROPERTY) + MACRO(KWSYS_SET_PROPERTY) + SET_PROPERTY(${ARGV}) + ENDMACRO(KWSYS_SET_PROPERTY) +ELSE(COMMAND SET_PROPERTY) + MACRO(KWSYS_SET_PROPERTY) + ENDMACRO(KWSYS_SET_PROPERTY) +ENDIF(COMMAND SET_PROPERTY) + # Tell CMake how to follow dependencies of sources in this directory. IF(COMMAND SET_PROPERTY) SET_PROPERTY(DIRECTORY @@ -786,6 +796,7 @@ ENDFOREACH(h) IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY LABELS ${KWSYS_LABELS_LIB}) IF(KWSYS_USE_DynamicLoader) IF(UNIX) TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS}) @@ -815,6 +826,7 @@ ENDIF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) # Add a C-only library if requested. IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS) ADD_LIBRARY(${KWSYS_NAMESPACE}_c ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS}) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}_c PROPERTY LABELS ${KWSYS_LABELS_LIB}) # Apply user-defined target properties to the library. IF(KWSYS_PROPERTIES_C) @@ -847,6 +859,8 @@ IF(KWSYS_USE_Process) # encode it into a C file. ADD_EXECUTABLE(${KWSYS_NAMESPACE}ProcessFwd9x ProcessFwd9x.c) ADD_EXECUTABLE(${KWSYS_NAMESPACE}EncodeExecutable EncodeExecutable.c) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}ProcessFwd9x PROPERTY LABELS ${KWSYS_LABELS_EXE}) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}EncodeExecutable PROPERTY LABELS ${KWSYS_LABELS_EXE}) # Construct the location of the executable to be encoded. SET(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -909,9 +923,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ${KWSYS_C_TESTS} ) ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsC ${KWSYS_C_TEST_SRCS}) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsC PROPERTY LABELS ${KWSYS_LABELS_EXE}) TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsC ${KWSYS_NAMESPACE}_c) FOREACH(test ${KWSYS_C_TESTS}) ADD_TEST(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsC ${test} ${KWSYS_TEST_ARGS_${test}}) + KWSYS_SET_PROPERTY(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST}) ENDFOREACH(test) # C++ tests @@ -935,12 +951,14 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testDynamicLoader) # If kwsys contains the DynamicLoader, need extra library ADD_LIBRARY(${KWSYS_NAMESPACE}TestDynload MODULE testDynload.c) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestDynload PROPERTY LABELS ${KWSYS_LABELS_LIB}) ENDIF(KWSYS_USE_DynamicLoader) CREATE_TEST_SOURCELIST( KWSYS_CXX_TEST_SRCS ${KWSYS_NAMESPACE}TestsCxx.cxx ${KWSYS_CXX_TESTS} ) ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS}) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE}) TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_NAMESPACE}) SET(TEST_SYSTEMTOOLS_BIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/testSystemTools.bin") @@ -987,16 +1005,19 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ) FOREACH(test ${KWSYS_CXX_TESTS}) ADD_TEST(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsCxx ${test} ${KWSYS_TEST_ARGS_${test}}) + KWSYS_SET_PROPERTY(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST}) ENDFOREACH(test) # Process tests. ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestProcess testProcess.c) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestProcess PROPERTY LABELS ${KWSYS_LABELS_EXE}) TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestProcess ${KWSYS_NAMESPACE}_c) IF(NOT CYGWIN) SET(KWSYS_TEST_PROCESS_7 7) ENDIF(NOT CYGWIN) FOREACH(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7}) ADD_TEST(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n}) + KWSYS_SET_PROPERTY(TEST kwsys.testProcess-${n} PROPERTY LABELS ${KWSYS_LABELS_TEST}) ENDFOREACH(n) # Test SharedForward @@ -1004,7 +1025,9 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ${PROJECT_BINARY_DIR}/testSharedForward.c @ONLY IMMEDIATE) ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestSharedForward ${PROJECT_BINARY_DIR}/testSharedForward.c) + KWSYS_SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestSharedForward PROPERTY LABELS ${KWSYS_LABELS_EXE}) ADD_TEST(kwsys.testSharedForward ${EXEC_DIR}/${KWSYS_NAMESPACE}TestSharedForward 1) + KWSYS_SET_PROPERTY(TEST kwsys.testSharedForward PROPERTY LABELS ${KWSYS_LABELS_TEST}) # Configure some test properties. IF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE) |