diff options
author | Kitware Robot <kwrobot@kitware.com> | 2012-08-13 17:47:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-08-13 18:19:16 (GMT) |
commit | 77543bde41b0e52c3959016698b529835945d62d (patch) | |
tree | ff63e5fbec326c4a5d821e7496c6d2cb52f75b92 /Tests/Complex/Library | |
parent | 7bbaa4283de26864b2e55e819db0884771585467 (diff) | |
download | CMake-77543bde41b0e52c3959016698b529835945d62d.zip CMake-77543bde41b0e52c3959016698b529835945d62d.tar.gz CMake-77543bde41b0e52c3959016698b529835945d62d.tar.bz2 |
Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands. Later command
names became case-insensitive. Now the preferred style is lower-case.
Run the following shell code:
cmake --help-command-list |
grep -v "cmake version" |
while read c; do
echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
Diffstat (limited to 'Tests/Complex/Library')
-rw-r--r-- | Tests/Complex/Library/CMakeLists.txt | 120 | ||||
-rw-r--r-- | Tests/Complex/Library/test_preprocess.cmake | 14 |
2 files changed, 67 insertions, 67 deletions
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index becf672..41faeba 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -1,90 +1,90 @@ -REMOVE_DEFINITIONS(-DCMAKE_IS_REALLY_FUN) +remove_definitions(-DCMAKE_IS_REALLY_FUN) # # Small utility used to create file # UTILITY_SOURCE is used for coverage and for getting the exact name # of the executable. # -UTILITY_SOURCE(CREATE_FILE_EXE create_file "." create_file.cxx) -ADD_EXECUTABLE(create_file create_file.cxx) -SET_TARGET_PROPERTIES(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".") +utility_source(CREATE_FILE_EXE create_file "." create_file.cxx) +add_executable(create_file create_file.cxx) +set_target_properties(create_file PROPERTIES RUNTIME_OUTPUT_DIRECTORY ".") # # Create static library # SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage # -AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources) -SET(LibrarySources ${LibrarySources} +aux_source_directory(ExtraSources LibrarySources) +set(LibrarySources ${LibrarySources} file2 empty create_file.cxx GENERATED nonexisting_file) -REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file) -ADD_LIBRARY(CMakeTestLibrary ${LibrarySources}) +remove(LibrarySources create_file.cxx GENERATED nonexisting_file) +add_library(CMakeTestLibrary ${LibrarySources}) -IF(WIN32) - IF(NOT CYGWIN) - IF(NOT BORLAND) - IF(NOT MINGW) - TARGET_LINK_LIBRARIES(CMakeTestLibrary +if(WIN32) + if(NOT CYGWIN) + if(NOT BORLAND) + if(NOT MINGW) + target_link_libraries(CMakeTestLibrary debug user32.lib) - TARGET_LINK_LIBRARIES(CMakeTestLibrary + target_link_libraries(CMakeTestLibrary optimized kernel32.lib) - ENDIF(NOT MINGW) - ENDIF(NOT BORLAND) - ENDIF(NOT CYGWIN) -ENDIF(WIN32) + endif(NOT MINGW) + endif(NOT BORLAND) + endif(NOT CYGWIN) +endif(WIN32) # # Create shared library # -SET(SharedLibrarySources sharedFile) -ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources}) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") -ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c) -DEFINE_PROPERTY( +set(SharedLibrarySources sharedFile) +add_library(CMakeTestLibraryShared SHARED ${SharedLibrarySources}) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS") +add_library(CMakeTestCLibraryShared SHARED testConly.c) +define_property( TARGET PROPERTY FOO BRIEF_DOCS "a test property" FULL_DOCS "A simple etst proerty that means nothign and is used for nothing" ) -SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR) -IF(NOT BEOS AND NOT WIN32) # No libm on BeOS. - SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") -ENDIF(NOT BEOS AND NOT WIN32) -GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO) -IF(${FOO_BAR_VAR} MATCHES "BAR") -ELSE(${FOO_BAR_VAR} MATCHES "BAR") - MESSAGE(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}") -ENDIF(${FOO_BAR_VAR} MATCHES "BAR") +set_target_properties(CMakeTestCLibraryShared PROPERTIES FOO BAR) +if(NOT BEOS AND NOT WIN32) # No libm on BeOS. + set_target_properties(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") +endif(NOT BEOS AND NOT WIN32) +get_target_property(FOO_BAR_VAR CMakeTestCLibraryShared FOO) +if(${FOO_BAR_VAR} MATCHES "BAR") +else(${FOO_BAR_VAR} MATCHES "BAR") + message(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}") +endif(${FOO_BAR_VAR} MATCHES "BAR") # Create static and shared lib of same name. -IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) - ADD_LIBRARY(CMakeTestLinkStatic STATIC TestLink.c) - ADD_LIBRARY(CMakeTestLinkShared SHARED TestLink.c) - SET_TARGET_PROPERTIES(CMakeTestLinkStatic CMakeTestLinkShared +if(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) + add_library(CMakeTestLinkStatic STATIC TestLink.c) + add_library(CMakeTestLinkShared SHARED TestLink.c) + set_target_properties(CMakeTestLinkStatic CMakeTestLinkShared PROPERTIES OUTPUT_NAME CMakeTestLink) -ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) +endif(CMAKE_EXE_LINK_STATIC_CXX_FLAGS) # # Attach pre-build/pre-link/post-build custom-commands to the lib. # Each runs ${CREATE_FILE_EXE} which will create a file. # The 'complex' executable will then test if this file exists and remove it. # -ADD_DEPENDENCIES(CMakeTestLibraryShared create_file) -MESSAGE("complex bin dir is ${Complex_BINARY_DIR}") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD +add_dependencies(CMakeTestLibraryShared create_file) +message("complex bin dir is ${Complex_BINARY_DIR}") +add_custom_command(TARGET CMakeTestLibraryShared PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/prebuild.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD +add_custom_command(TARGET CMakeTestLibraryShared PRE_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/prelink.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD +add_custom_command(TARGET CMakeTestLibraryShared POST_BUILD COMMAND ${CREATE_FILE_EXE} ARGS "${Complex_BINARY_DIR}/Library/postbuild.txt") -ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD +add_custom_command(TARGET CMakeTestLibraryShared POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy "${Complex_BINARY_DIR}/Library/postbuild.txt" @@ -95,46 +95,46 @@ ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD # It runs ${CREATE_FILE_EXE} which will create a file. # The 'complex' executable will then test if this file exists and remove it. # -ADD_CUSTOM_TARGET(custom_target1 +add_custom_target(custom_target1 ALL ${CREATE_FILE_EXE} "${Complex_BINARY_DIR}/Library/custom_target1.txt") -ADD_DEPENDENCIES(custom_target1 create_file) +add_dependencies(custom_target1 create_file) # # Extra coverage # -SET_SOURCE_FILES_PROPERTIES(file2 PROPERTIES ABSTRACT 1) +set_source_files_properties(file2 PROPERTIES ABSTRACT 1) -INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) -INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) +install_files(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h) +install_files(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h) # Test creating a library that is not built by default. -ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx) +add_library(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx) # Create an imported target for if(TARGET) test in Executable dir. # That test should not see this target. -ADD_LIBRARY(LibImportedTarget UNKNOWN IMPORTED) +add_library(LibImportedTarget UNKNOWN IMPORTED) # Test generation of preprocessed sources. -IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) - IF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) +if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) + if(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) # Skip running this part of the test on certain platforms # until they are fixed. - SET(MAYBE_ALL ALL) - LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT) - IF(ARCH_COUNT GREATER 1) + set(MAYBE_ALL ALL) + list(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT) + if(ARCH_COUNT GREATER 1) # OSX does not support preprocessing more than one architecture. - SET(MAYBE_ALL) - ENDIF(ARCH_COUNT GREATER 1) + set(MAYBE_ALL) + endif(ARCH_COUNT GREATER 1) # Custom target to try preprocessing invocation. - ADD_CUSTOM_TARGET(test_preprocess ${MAYBE_ALL} + add_custom_target(test_preprocess ${MAYBE_ALL} COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - ENDIF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) -ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) + endif(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE) +endif("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) diff --git a/Tests/Complex/Library/test_preprocess.cmake b/Tests/Complex/Library/test_preprocess.cmake index d2d9fc6..885c613 100644 --- a/Tests/Complex/Library/test_preprocess.cmake +++ b/Tests/Complex/Library/test_preprocess.cmake @@ -1,7 +1,7 @@ -SET(TEST_FILE CMakeFiles/create_file.dir/create_file.i) -FILE(READ ${TEST_FILE} CONTENTS) -IF("${CONTENTS}" MATCHES "Unable to close") - MESSAGE(STATUS "${TEST_FILE} created successfully!") -ELSE("${CONTENTS}" MATCHES "Unable to close") - MESSAGE(FATAL_ERROR "${TEST_FILE} creation failed!") -ENDIF("${CONTENTS}" MATCHES "Unable to close") +set(TEST_FILE CMakeFiles/create_file.dir/create_file.i) +file(READ ${TEST_FILE} CONTENTS) +if("${CONTENTS}" MATCHES "Unable to close") + message(STATUS "${TEST_FILE} created successfully!") +else("${CONTENTS}" MATCHES "Unable to close") + message(FATAL_ERROR "${TEST_FILE} creation failed!") +endif("${CONTENTS}" MATCHES "Unable to close") |