STYLE: Nightly Version update
[cmake.git] / Tests / ComplexOneConfig / Library / CMakeLists.txt
blob1f0b0fa7702a96ea8961cb7080a5276c726cbf5f
1 REMOVE_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
4 # Small utility used to create file
5 # UTILITY_SOURCE is used for coverage and for getting the exact name
6 # of the executable.
8 UTILITY_SOURCE(CREATE_FILE_EXE create_file "." create_file.cxx)
9 ADD_EXECUTABLE(create_file create_file.cxx)
12 # Create static library
13 # SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage
15 AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources)
16 SOURCE_FILES(LibrarySources 
17   file2 
18   empty 
19   create_file.cxx 
20   GENERATED 
21   nonexisting_file)
22 SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file) 
23 ADD_LIBRARY(CMakeTestLibrary ${LibrarySources})
25 IF(WIN32)
26   IF(NOT CYGWIN)
27     IF(NOT BORLAND)
28       IF(NOT MINGW)
29         TARGET_LINK_LIBRARIES(CMakeTestLibrary
30           debug 
31           user32.lib)
32         TARGET_LINK_LIBRARIES(CMakeTestLibrary
33           optimized 
34           kernel32.lib)
35       ENDIF(NOT MINGW)
36     ENDIF(NOT BORLAND)
37   ENDIF(NOT CYGWIN)
38 ENDIF(WIN32)
41 # Create shared library
43 SOURCE_FILES(SharedLibrarySources sharedFile)
44 ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
45 ADD_LIBRARY(CMakeTestModule MODULE moduleFile.c)
46 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
47 ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
48 SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR)
49 SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
50 GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
51 IF(${FOO_BAR_VAR} MATCHES "BAR")
52 ELSE(${FOO_BAR_VAR} MATCHES "BAR")
53   MESSAGE(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}")
54 ENDIF(${FOO_BAR_VAR} MATCHES "BAR")
58 # Attach pre-build/pre-link/post-build custom-commands to the lib.
59 # Each runs ${CREATE_FILE_EXE} which will create a file.
60 # The 'complex' executable will then test if this file exists and remove it.
62 ADD_DEPENDENCIES(CMakeTestLibraryShared create_file)
63 MESSAGE("complex bin dir is ${Complex_BINARY_DIR}")
64 ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD
65                    COMMAND ${CREATE_FILE_EXE}
66                    ARGS "${Complex_BINARY_DIR}/Library/prebuild.txt")
67 ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared PRE_BUILD
68                    COMMAND ${CREATE_FILE_EXE}
69                    ARGS "${Complex_BINARY_DIR}/Library/prelink.txt")
70 ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD
71                    COMMAND ${CREATE_FILE_EXE}
72                    ARGS "${Complex_BINARY_DIR}/Library/postbuild.txt")
73 ADD_CUSTOM_COMMAND(TARGET CMakeTestLibraryShared POST_BUILD
74                    COMMAND ${CMAKE_COMMAND}
75                    ARGS -E copy
76                         "${Complex_BINARY_DIR}/Library/postbuild.txt"
77                         "${Complex_BINARY_DIR}/Library/postbuild2.txt")
80 # Add a custom target.
81 # It runs ${CREATE_FILE_EXE} which will create a file.
82 # The 'complex' executable will then test if this file exists and remove it.
84 ADD_CUSTOM_TARGET(custom_target1
85                   ALL
86                   ${CREATE_FILE_EXE} 
87                   "${Complex_BINARY_DIR}/Library/custom_target1.txt")
89 ADD_DEPENDENCIES(custom_target1 create_file)
92 # Extra coverage
94 ABSTRACT_FILES(
95   file2
98 INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
99 INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)