summaryrefslogtreecommitdiff
path: root/Tests/CustomCommand/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CustomCommand/CMakeLists.txt')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt156
1 files changed, 78 insertions, 78 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index b7c9ea2..d3ced3f 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -2,22 +2,22 @@
# Wrapping
#
cmake_minimum_required (VERSION 2.6)
-PROJECT (CustomCommand)
+project (CustomCommand)
-ADD_SUBDIRECTORY(GeneratedHeader)
+add_subdirectory(GeneratedHeader)
#
# Lib and exe path
#
-IF(NOT DEFINED bin_dir)
- SET(bin_dir "bin")
-ENDIF()
+if(NOT DEFINED bin_dir)
+ set(bin_dir "bin")
+endif()
-SET (LIBRARY_OUTPUT_PATH
+set (LIBRARY_OUTPUT_PATH
${PROJECT_BINARY_DIR}/${bin_dir} CACHE INTERNAL
"Single output directory for building all libraries.")
-SET (EXECUTABLE_OUTPUT_PATH
+set (EXECUTABLE_OUTPUT_PATH
${PROJECT_BINARY_DIR}/${bin_dir} CACHE INTERNAL
"Single output directory for building all executables.")
@@ -27,10 +27,10 @@ SET (EXECUTABLE_OUTPUT_PATH
#
################################################################
# add the executable that will generate the file
-ADD_EXECUTABLE(generator generator.cxx)
+add_executable(generator generator.cxx)
-GET_TARGET_PROPERTY(generator_PATH generator LOCATION)
-MESSAGE("Location ${generator_PATH}")
+get_target_property(generator_PATH generator LOCATION)
+message("Location ${generator_PATH}")
################################################################
#
@@ -38,9 +38,9 @@ MESSAGE("Location ${generator_PATH}")
#
################################################################
# add the executable that will generate the file
-ADD_EXECUTABLE(wrapper wrapper.cxx)
+add_executable(wrapper wrapper.cxx)
-ADD_CUSTOM_COMMAND(
+add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/wrapped.c ${PROJECT_BINARY_DIR}/wrapped_help.c
DEPENDS wrapper
MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/wrapped.h
@@ -55,19 +55,19 @@ ADD_CUSTOM_COMMAND(
# Test creating files from a custom target
#
################################################################
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}//doc1.dvi # test 2 slashes
- DEPENDS ${PROJECT_SOURCE_DIR}/doc1.tex
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy ${PROJECT_SOURCE_DIR}/doc1.tex
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}//doc1.dvi # test 2 slashes
+ DEPENDS ${PROJECT_SOURCE_DIR}/doc1.tex
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy ${PROJECT_SOURCE_DIR}/doc1.tex
${PROJECT_BINARY_DIR}/doc1.dvi
)
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.dvi to doc1temp.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.dvi
${PROJECT_BINARY_DIR}/doc1temp.h
)
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND
DEPENDS ${PROJECT_BINARY_DIR}/doc1.dvi
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1temp.h to doc1.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1temp.h
@@ -77,7 +77,7 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND
)
# Add custom command to generate foo.h.
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.h
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.h
DEPENDS ${PROJECT_SOURCE_DIR}/foo.h.in
COMMAND ${CMAKE_COMMAND} -E echo " Copying foo.h.in to foo.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/foo.h.in
@@ -85,12 +85,12 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.h
)
# Add the location of foo.h to the include path.
-INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
+include_directories(${PROJECT_BINARY_DIR})
# Test generation of a file to the build tree without full path. As
# of CMake 2.6 custom command outputs specified by relative path go in
# the build tree.
-ADD_CUSTOM_COMMAND(
+add_custom_command(
OUTPUT doc1.txt
COMMAND ${CMAKE_COMMAND} -E echo "Example Document Target" > doc1.txt
DEPENDS doc1.tex
@@ -98,7 +98,7 @@ ADD_CUSTOM_COMMAND(
)
# Add a custom target to drive generation of doc1.h.
-ADD_CUSTOM_TARGET(TDocument ALL
+add_custom_target(TDocument ALL
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.h to doc2.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.h
${PROJECT_BINARY_DIR}/doc2.h
@@ -109,13 +109,13 @@ ADD_CUSTOM_TARGET(TDocument ALL
# Setup a pre- and post-build pair that will fail if not run in the
# proper order.
-ADD_CUSTOM_COMMAND(
+add_custom_command(
TARGET TDocument PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E echo " Writing doc1pre.txt."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc1.tex ${PROJECT_BINARY_DIR}/doc1pre.txt
COMMENT "Running TDocument pre-build commands"
)
-ADD_CUSTOM_COMMAND(
+add_custom_command(
TARGET TDocument POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1pre.txt to doc2post.txt."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1pre.txt
@@ -128,16 +128,16 @@ ADD_CUSTOM_COMMAND(
# Test using a multistep generated file
#
################################################################
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.pre
+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
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy ${PROJECT_SOURCE_DIR}/foo.in
${PROJECT_BINARY_DIR}/foo.pre
)
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.c
- DEPENDS ${PROJECT_BINARY_DIR}/foo.pre
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.c
+ DEPENDS ${PROJECT_BINARY_DIR}/foo.pre
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${PROJECT_BINARY_DIR}/foo.pre
${PROJECT_BINARY_DIR}/foo.c
@@ -147,21 +147,21 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.c
# file that is not included by any source in this project. This will
# test whether all custom command outputs explicitly listed as sources
# get generated even if they are not needed by an object file.
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/not_included.h
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/not_included.h
DEPENDS ${PROJECT_SOURCE_DIR}/foo.h.in
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/foo.h.in
${PROJECT_BINARY_DIR}/not_included.h
)
# Tell the executable where to find not_included.h.
-CONFIGURE_FILE(
+configure_file(
${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h
@ONLY IMMEDIATE
)
# add the executable
-ADD_EXECUTABLE(CustomCommand
+add_executable(CustomCommand
${PROJECT_BINARY_DIR}/foo.h
${PROJECT_BINARY_DIR}/foo.c
${PROJECT_BINARY_DIR}/wrapped.c
@@ -174,44 +174,44 @@ ADD_EXECUTABLE(CustomCommand
# Add the rule to create generated.c at build time. This is placed
# here to test adding the generation rule after referencing the
# generated source in a target.
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
+add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
DEPENDS generator
COMMAND ${generator_PATH}
ARGS ${PROJECT_BINARY_DIR}/generated.c
)
-TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader)
+target_link_libraries(CustomCommand GeneratedHeader)
##############################################################################
# Test for using just the target name as executable in the COMMAND
# section. Has to be recognized and replaced by CMake with the output
# actual location of the executable.
-# Additionally the generator is created in an extra subdir after the
-# ADD_CUSTOM_COMMAND() is used.
+# Additionally the generator is created in an extra subdir after the
+# add_custom_command() is used.
#
-# Test the same for ADD_CUSTOM_TARGET()
+# Test the same for add_custom_target()
-ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx
COMMAND generator_extern ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx
)
-ADD_EXECUTABLE(CustomCommandUsingTargetTest main.cxx ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx )
+add_executable(CustomCommandUsingTargetTest main.cxx ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx )
-ADD_CUSTOM_TARGET(RunTarget
+add_custom_target(RunTarget
COMMAND generator_extern ${CMAKE_CURRENT_BINARY_DIR}/run_target.cxx
)
-ADD_CUSTOM_COMMAND(TARGET CustomCommandUsingTargetTest POST_BUILD
+add_custom_command(TARGET CustomCommandUsingTargetTest POST_BUILD
COMMAND dummy_generator ${CMAKE_CURRENT_BINARY_DIR}/generated_dummy.cxx)
-ADD_SUBDIRECTORY(GeneratorInExtraDir)
+add_subdirectory(GeneratorInExtraDir)
##############################################################################
# Test shell operators in custom commands.
-ADD_EXECUTABLE(tcat tcat.cxx)
+add_executable(tcat tcat.cxx)
-ADD_CUSTOM_COMMAND(OUTPUT gen_redirect.c
+add_custom_command(OUTPUT gen_redirect.c
DEPENDS tcat gen_redirect_in.c
COMMAND tcat < ${CMAKE_CURRENT_SOURCE_DIR}/gen_redirect_in.c > gen_redirect.c
COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> gen_redirect.c
@@ -220,12 +220,12 @@ ADD_CUSTOM_COMMAND(OUTPUT gen_redirect.c
##############################################################################
# Test non-trivial command line arguments in custom commands.
-SET(EXPECTED_ARGUMENTS)
-SET(CHECK_ARGS)
-IF(NOT MSVC71)
- SET(CHECK_ARGS -DPATH=c:/posix/path)
-ENDIF()
-SET(CHECK_ARGS
+set(EXPECTED_ARGUMENTS)
+set(CHECK_ARGS)
+if(NOT MSVC71)
+ set(CHECK_ARGS -DPATH=c:/posix/path)
+endif()
+set(CHECK_ARGS
${CHECK_ARGS}
c:/posix/path
c:\\windows\\path
@@ -333,11 +333,11 @@ SET(CHECK_ARGS
"one#pound w s"
~ ` ! @ \# $ % ^ & _ - + = : "\;" \" ' , . ? "(" ")" { } []
)
-IF(NOT MINGW)
+if(NOT MINGW)
# * # MinGW programs on windows always expands the wildcard!
# / # MSys make converts a leading slash to the mingw home directory
- LIST(APPEND CHECK_ARGS * /)
-ENDIF(NOT MINGW)
+ list(APPEND CHECK_ARGS * /)
+endif()
# The windows command shell does not support a double quote by itself:
# double\"quote
@@ -352,25 +352,25 @@ ENDIF(NOT MINGW)
# | < > << >> &> 2>&1 1>&2
# to allow custom commands to perform redirection.
-FOREACH(arg ${CHECK_ARGS} "")
- SET(ARG "${arg}")
- STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}")
- STRING(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}")
- SET(EXPECTED_ARGUMENTS
+foreach(arg ${CHECK_ARGS} "")
+ set(ARG "${arg}")
+ string(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}")
+ string(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}")
+ set(EXPECTED_ARGUMENTS
"${EXPECTED_ARGUMENTS} \"${ARG}\",
")
-ENDFOREACH(arg)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in
+endforeach()
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in
${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c
@ONLY IMMEDIATE)
-ADD_EXECUTABLE(check_command_line
+add_executable(check_command_line
${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c)
-SET(output_name "check_command_line")
-SET_PROPERTY(TARGET check_command_line
+set(output_name "check_command_line")
+set_property(TARGET check_command_line
PROPERTY OUTPUT_NAME ${output_name})
-# SET_TARGET_PROPERTIES(check_command_line PROPERTIES
+# set_target_properties(check_command_line PROPERTIES
# COMPILE_FLAGS -DCHECK_COMMAND_LINE_VERBOSE)
-ADD_CUSTOM_COMMAND(
+add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/command_line_check
COMMAND ${CMAKE_COMMAND} -DMARK_FILE=${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt
-P ${CMAKE_CURRENT_SOURCE_DIR}/check_mark.cmake
@@ -379,9 +379,9 @@ ADD_CUSTOM_COMMAND(
VERBATIM
COMMENT "Checking custom command line escapes (single'quote)"
)
-SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/command_line_check
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/command_line_check
PROPERTIES SYMBOLIC 1)
-ADD_CUSTOM_TARGET(do_check_command_line ALL
+add_custom_target(do_check_command_line ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/command_line_check
COMMAND ${CMAKE_COMMAND} -E echo "Checking custom target command escapes"
COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/${output_name}
@@ -389,12 +389,12 @@ ADD_CUSTOM_TARGET(do_check_command_line ALL
VERBATIM
COMMENT "Checking custom target command line escapes ($dollar-signs$)"
)
-ADD_DEPENDENCIES(do_check_command_line check_command_line)
+add_dependencies(do_check_command_line check_command_line)
-ADD_CUSTOM_TARGET(pre_check_command_line
+add_custom_target(pre_check_command_line
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt
)
-ADD_DEPENDENCIES(do_check_command_line pre_check_command_line)
+add_dependencies(do_check_command_line pre_check_command_line)
# <SameNameTest>
#
@@ -405,34 +405,34 @@ ADD_DEPENDENCIES(do_check_command_line pre_check_command_line)
# At first, this reproduces a bug reported by a customer. After fixing it,
# having this test here makes sure it stays fixed moving forward.
#
-ADD_CUSTOM_COMMAND(
+add_custom_command(
OUTPUT SameName1.txt
COMMAND ${CMAKE_COMMAND} -E touch SameName1.txt
)
-ADD_CUSTOM_TARGET(SameName ALL
+add_custom_target(SameName ALL
DEPENDS SameName1.txt
)
-ADD_CUSTOM_COMMAND(
+add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/subdir
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName
)
-ADD_CUSTOM_TARGET(DifferentName ALL
+add_custom_target(DifferentName ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir/SameName
)
#
# </SameNameTest>
# Per-config target name and generator expressions.
-ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig)
-ADD_CUSTOM_COMMAND(
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig)
+add_custom_command(
OUTPUT perconfig.out
COMMAND ${PerConfig_COMMAND}
DEPENDS ${PerConfig_DEPENDS}
VERBATIM
)
-SET_PROPERTY(SOURCE perconfig.out PROPERTY SYMBOLIC 1)
-ADD_CUSTOM_TARGET(perconfig_target ALL
+set_property(SOURCE perconfig.out PROPERTY SYMBOLIC 1)
+add_custom_target(perconfig_target ALL
COMMAND ${CMAKE_COMMAND} -E echo "perconfig=$<TARGET_FILE:perconfig>" "config=$<CONFIGURATION>"
DEPENDS perconfig.out)