[cmake-commits] alex committed CMakeLists.txt 1.27 1.27.2.1 main.cxx
NONE 1.1.2.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri May 4 16:43:32 EDT 2007
Update of /cvsroot/CMake/CMake/Tests/CustomCommand
In directory public:/mounts/ram/cvs-serv17125/Tests/CustomCommand
Modified Files:
Tag: CMake-ACC-TargetUsedAsCommand
CMakeLists.txt
Added Files:
Tag: CMake-ACC-TargetUsedAsCommand
main.cxx
Log Message:
ENH: you can now use the target name of a executable target in cmake as
command in add_custom_command, it should also honor the buildtypes. A
testcase in Tests/CustomCommand/ is also coming soon. Tested on Linux with
Makefiles, OSX with XCode and MSVC 7. MSVC 6 and 8 are not tested. Next will
be to also automatically add the dependencies to this target automatically.
Alex
--- NEW FILE: main.cxx ---
extern int generated();
int main()
{
return generated();
}
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CustomCommand/CMakeLists.txt,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -u -d -r1.27 -r1.27.2.1
--- CMakeLists.txt 1 May 2007 18:12:56 -0000 1.27
+++ CMakeLists.txt 4 May 2007 20:43:29 -0000 1.27.2.1
@@ -168,6 +168,23 @@
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
+# actual location of the executable.
+# Additionally the generator is created in an extra subdir after the
+# ADD_CUSTOM_COMMAND() is used.
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx
+ COMMAND generator_extern ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx
+ DEPENDS generator_extern
+ )
+
+ADD_EXECUTABLE(CustomCommandUsingTargetTest main.cxx ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx )
+
+ADD_SUBDIRECTORY(GeneratorInExtraDir)
+
+
+##############################################################################
# Test non-trivial command line arguments in custom commands.
SET(EXPECTED_ARGUMENTS)
SET(CHECK_ARGS
More information about the Cmake-commits
mailing list