mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
ENH: Added full pre-build/pre-link/post-build testing for both library and executable targets.
This commit is contained in:
@@ -27,6 +27,22 @@ ELSE(UNIX)
|
||||
ENDIF(NOT BORLAND)
|
||||
ENDIF (UNIX)
|
||||
|
||||
# Test pre-build/pre-link/post-build rules for an executable.
|
||||
ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD
|
||||
COMMAND ${CREATE_FILE_EXE}
|
||||
ARGS "${Complex_BINARY_DIR}/Executable/prebuild.txt")
|
||||
ADD_CUSTOM_COMMAND(TARGET complex PRE_BUILD
|
||||
COMMAND ${CREATE_FILE_EXE}
|
||||
ARGS "${Complex_BINARY_DIR}/Executable/prelink.txt")
|
||||
ADD_CUSTOM_COMMAND(TARGET complex POST_BUILD
|
||||
COMMAND ${CREATE_FILE_EXE}
|
||||
ARGS "${Complex_BINARY_DIR}/Executable/postbuild.txt")
|
||||
ADD_CUSTOM_COMMAND(TARGET complex POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy
|
||||
"${Complex_BINARY_DIR}/Executable/postbuild.txt"
|
||||
"${Complex_BINARY_DIR}/Executable/postbuild2.txt")
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(complex
|
||||
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS"
|
||||
OBJECT_DEPENDS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
|
||||
|
||||
@@ -734,16 +734,24 @@ int main()
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// A post-build custom-command has been attached to the lib (see Library/).
|
||||
// It runs ${CREATE_FILE_EXE} which will create a file.
|
||||
// It also copies that file again using CCOMMAND.
|
||||
// Some pre-build/pre-link/post-build custom-commands have been
|
||||
// attached to the lib (see Library/).
|
||||
// Each runs ${CREATE_FILE_EXE} which will create a file.
|
||||
// It also copies that file again using cmake -E.
|
||||
// Similar rules have been added to this executable.
|
||||
//
|
||||
// WARNING: if you run 'complex' manually, this *will* fail, because
|
||||
// the file was removed the last time 'complex' was run, and it is
|
||||
// only created during a build.
|
||||
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/prebuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/prelink.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/postbuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/postbuild2.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/prebuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/prelink.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/postbuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/postbuild2.txt");
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// A custom target has been created (see Library/).
|
||||
|
||||
Reference in New Issue
Block a user