CMakeLists.txt 3.22 KB
Newer Older
Ken Martin's avatar
Ken Martin committed
1
CMAKE_MINIMUM_REQUIRED(VERSION 1.3)
2
3
4
#
# Create exe. 
#
5
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
6
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
Bill Hoffman's avatar
Bill Hoffman committed
7
SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
8

9
10
# Link to CMake lib
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source)
Brad King's avatar
Brad King committed
11
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
12
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat)
Andy Cedilnik's avatar
Andy Cedilnik committed
13
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib)
Andy Cedilnik's avatar
Andy Cedilnik committed
14
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmcurl)
Sebastien Barre's avatar
Sebastien Barre committed
15
# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to 
16
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
Sebastien Barre's avatar
Sebastien Barre committed
17
LINK_LIBRARIES(${COMPLEX_LIBS})
18

19
ADD_EXECUTABLE(A A.cxx)
20
ADD_EXECUTABLE(complex complex testcflags.c)
21
ADD_EXECUTABLE(complex.file complex.file.cxx)
22
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar)
Ken Martin's avatar
Ken Martin committed
23
IF (UNIX)
Andy Cedilnik's avatar
Andy Cedilnik committed
24
  TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS})
Ken Martin's avatar
Ken Martin committed
25
ELSE(UNIX)
26
  IF (NOT BORLAND)
27
28
29
    IF(NOT MINGW)
      TARGET_LINK_LIBRARIES(complex rpcrt4.lib)
    ENDIF(NOT MINGW)
30
  ENDIF(NOT BORLAND)
Ken Martin's avatar
Ken Martin committed
31
ENDIF (UNIX)
Ken Martin's avatar
Ken Martin committed
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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")

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
SET_SOURCE_FILES_PROPERTIES(complex
  COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS"
  OBJECT_DEPENDS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
)

ADD_CUSTOM_COMMAND(
  TARGET complex
  SOURCE ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
  COMMAND ${CMAKE_COMMAND}
  ARGS -E copy ${Complex_SOURCE_DIR}/cmTestGeneratedHeader.h.in
               ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
  OUTPUTS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
  DEPENDS ${CMAKE_COMMAND}
)

Sebastien Barre's avatar
Sebastien Barre committed
64
65
66
#
# Output the files required by 'complex' to a file.
#
67
68
69
70
# This test has been moved to the 'required' subdir so that it
# has no side-effects on the current Makefile (duplicated source file
# due to source list expansion done twice).
#
71
ADD_SUBDIRECTORY(Temp)
Sebastien Barre's avatar
Sebastien Barre committed
72

73
#
74
# Extra coverage.Not used.
75
#
76
77
INSTALL_TARGETS(/tmp complex)
INSTALL_PROGRAMS(/tmp complex)
78

Ken Martin's avatar
Ken Martin committed
79
80
81
82
CONFIGURE_FILE(
  ${Complex_SOURCE_DIR}/Executable/cmVersion.h.in
  ${Complex_BINARY_DIR}/cmVersion.h)

83
SOURCE_GROUP(A_GROUP ".cxx")
Bill Hoffman's avatar
Bill Hoffman committed
84
85
86
SOURCE_GROUP(B_GROUP REGULAR_EXPRESSION "cxx")
SOURCE_GROUP(C_GROUP FILES complex.cxx)

87
88
89
90
91
92
FILE(WRITE ${Complex_BINARY_DIR}/A/libA.a "test")
FILE(WRITE ${Complex_BINARY_DIR}/A/libC.a "test")
FILE(WRITE ${Complex_BINARY_DIR}/B/libB.a "test")
FILE(WRITE ${Complex_BINARY_DIR}/B/libA.a "test")
FILE(WRITE ${Complex_BINARY_DIR}/C/libC.a "test")
FILE(WRITE ${Complex_BINARY_DIR}/C/libB.a "test")