2002-04-22 19:51:26 +04:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 1.3)
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Create exe.
|
|
|
|
#
|
2002-04-09 20:02:48 +04:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
|
2005-08-01 17:44:44 +04:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
|
2005-08-01 06:25:39 +04:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
|
2002-12-14 01:35:00 +03:00
|
|
|
|
2006-10-19 22:45:41 +04:00
|
|
|
IF(COMPLEX_TEST_CMAKELIB)
|
2006-01-17 22:35:04 +03:00
|
|
|
# Link to CMake lib
|
|
|
|
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source)
|
|
|
|
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
|
|
|
|
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmexpat)
|
|
|
|
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmzlib)
|
|
|
|
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Utilities/cmtar)
|
2006-10-19 22:45:41 +04:00
|
|
|
ENDIF(COMPLEX_TEST_CMAKELIB)
|
2006-01-17 22:35:04 +03:00
|
|
|
|
|
|
|
# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
|
2002-05-02 21:17:10 +04:00
|
|
|
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
|
2002-04-11 19:30:05 +04:00
|
|
|
LINK_LIBRARIES(${COMPLEX_LIBS})
|
2001-08-23 21:57:45 +04:00
|
|
|
|
2006-08-03 17:26:36 +04:00
|
|
|
ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt)
|
2006-04-18 02:10:16 +04:00
|
|
|
ADD_EXECUTABLE(complex complex testcflags.c )
|
|
|
|
# Sub1/NameConflictTest.c Sub2/NameConflictTest.c)
|
2003-08-01 22:34:51 +04:00
|
|
|
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
2006-10-19 22:45:41 +04:00
|
|
|
IF(COMPLEX_TEST_CMAKELIB)
|
2006-01-17 18:21:45 +03:00
|
|
|
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar)
|
2006-10-19 22:45:41 +04:00
|
|
|
ENDIF(COMPLEX_TEST_CMAKELIB)
|
2006-01-17 18:21:45 +03:00
|
|
|
|
2002-08-29 00:33:38 +04:00
|
|
|
IF (UNIX)
|
2005-01-19 01:29:25 +03:00
|
|
|
TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS})
|
2002-08-29 00:33:38 +04:00
|
|
|
ELSE(UNIX)
|
2002-08-30 17:54:48 +04:00
|
|
|
IF (NOT BORLAND)
|
2003-08-28 00:42:01 +04:00
|
|
|
IF(NOT MINGW)
|
|
|
|
TARGET_LINK_LIBRARIES(complex rpcrt4.lib)
|
|
|
|
ENDIF(NOT MINGW)
|
2002-08-30 17:54:48 +04:00
|
|
|
ENDIF(NOT BORLAND)
|
2002-08-29 00:33:38 +04:00
|
|
|
ENDIF (UNIX)
|
2002-08-22 23:58:22 +04:00
|
|
|
|
2006-09-15 22:31:24 +04:00
|
|
|
# Test linking to static lib when a shared lib has the same name.
|
|
|
|
IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
|
|
|
|
ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC)
|
|
|
|
TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic)
|
|
|
|
ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
|
|
|
|
|
2006-03-22 23:01:22 +03:00
|
|
|
# can we get the path to a source file
|
|
|
|
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
|
|
|
|
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
|
|
|
|
ADD_DEFINITIONS(-DCMAKE_FOUND_ACXX)
|
|
|
|
ENDIF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
|
|
|
|
|
|
|
|
# get the directory parent
|
|
|
|
GET_DIRECTORY_PROPERTY(P_VALUE PARENT_DIRECTORY)
|
|
|
|
IF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
|
|
|
ADD_DEFINITIONS(-DCMAKE_FOUND_PARENT)
|
|
|
|
ENDIF ("${P_VALUE}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
|
|
|
|
|
|
|
# get the stack of listfiles
|
|
|
|
INCLUDE(Included.cmake)
|
|
|
|
IF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
|
|
|
|
ADD_DEFINITIONS(-DCMAKE_FOUND_LISTFILE_STACK)
|
|
|
|
ENDIF ("${LF_VALUE}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt;${CMAKE_CURRENT_SOURCE_DIR}/Included.cmake")
|
|
|
|
|
2006-05-23 20:51:26 +04:00
|
|
|
# Test add/remove definitions.
|
|
|
|
ADD_DEFINITIONS(
|
|
|
|
-DCOMPLEX_DEFINED_PRE
|
|
|
|
-DCOMPLEX_DEFINED
|
|
|
|
-DCOMPLEX_DEFINED_POST
|
|
|
|
-DCOMPLEX_DEFINED
|
|
|
|
)
|
|
|
|
REMOVE_DEFINITIONS(-DCOMPLEX_DEFINED)
|
2006-03-22 23:01:22 +03:00
|
|
|
|
2005-02-25 17:31:55 +03:00
|
|
|
# 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")
|
|
|
|
|
2002-12-14 01:35:00 +03:00
|
|
|
SET_SOURCE_FILES_PROPERTIES(complex
|
2007-05-09 18:18:31 +04:00
|
|
|
COMPILE_FLAGS
|
|
|
|
"-DFILE_HAS_EXTRA_COMPILE_FLAGS -DFILE_DEFINE_STRING=\\\"hello\\\""
|
2002-12-14 01:35:00 +03:00
|
|
|
OBJECT_DEPENDS ${Complex_BINARY_DIR}/cmTestGeneratedHeader.h
|
|
|
|
)
|
2006-01-25 16:38:06 +03:00
|
|
|
SET_TARGET_PROPERTIES(complex PROPERTIES COMPILE_FLAGS "-DCOMPLEX_TARGET_FLAG")
|
2002-12-14 01:35:00 +03:00
|
|
|
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}
|
|
|
|
)
|
|
|
|
|
2006-10-02 19:14:00 +04:00
|
|
|
# Test creating an executable that is not built by default.
|
2006-10-02 20:01:20 +04:00
|
|
|
ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
|
2006-10-02 19:14:00 +04:00
|
|
|
TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
|
|
|
|
|
2007-02-01 20:02:24 +03:00
|
|
|
# Test user-value flag mapping for the VS IDE.
|
|
|
|
IF(MSVC)
|
|
|
|
SET_TARGET_PROPERTIES(notInAllExe PROPERTIES
|
|
|
|
LINK_FLAGS "/NODEFAULTLIB:LIBC;LIBCMT;MSVCRT")
|
|
|
|
ENDIF(MSVC)
|
|
|
|
|
2006-10-02 19:14:00 +04:00
|
|
|
# Test creating a custom target that builds not-in-all targets.
|
|
|
|
ADD_CUSTOM_TARGET(notInAllCustom)
|
|
|
|
ADD_DEPENDENCIES(notInAllCustom notInAllExe)
|
|
|
|
|
2002-01-20 08:12:27 +03:00
|
|
|
#
|
|
|
|
# Output the files required by 'complex' to a file.
|
|
|
|
#
|
2002-01-22 21:30:06 +03:00
|
|
|
# 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).
|
|
|
|
#
|
2005-06-08 20:26:32 +04:00
|
|
|
ADD_SUBDIRECTORY(Temp)
|
2002-01-20 08:12:27 +03:00
|
|
|
|
2006-10-05 19:30:44 +04:00
|
|
|
IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
|
2006-10-05 16:55:59 +04:00
|
|
|
ADD_EXECUTABLE(testSystemDir testSystemDir.cxx)
|
|
|
|
SET_TARGET_PROPERTIES(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror")
|
2006-10-05 19:30:44 +04:00
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
|
2006-10-05 16:55:59 +04:00
|
|
|
|
2002-01-19 04:32:06 +03:00
|
|
|
#
|
2002-01-20 05:24:55 +03:00
|
|
|
# Extra coverage.Not used.
|
2002-01-19 04:32:06 +03:00
|
|
|
#
|
2002-01-19 03:21:43 +03:00
|
|
|
INSTALL_TARGETS(/tmp complex)
|
|
|
|
INSTALL_PROGRAMS(/tmp complex)
|
2002-01-20 05:24:55 +03:00
|
|
|
|
2002-04-22 19:51:26 +04:00
|
|
|
CONFIGURE_FILE(
|
|
|
|
${Complex_SOURCE_DIR}/Executable/cmVersion.h.in
|
|
|
|
${Complex_BINARY_DIR}/cmVersion.h)
|
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
SOURCE_GROUP(A_GROUP ".cxx")
|
2003-08-08 00:07:23 +04:00
|
|
|
SOURCE_GROUP(B_GROUP REGULAR_EXPRESSION "cxx")
|
|
|
|
SOURCE_GROUP(C_GROUP FILES complex.cxx)
|
|
|
|
|
2005-03-03 01:49:11 +03:00
|
|
|
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")
|