2002-01-17 23:49:08 +03:00
|
|
|
#
|
2002-01-19 03:21:43 +03:00
|
|
|
# A more complex test case
|
2002-01-17 23:49:08 +03:00
|
|
|
#
|
2001-08-23 21:57:45 +04:00
|
|
|
PROJECT (Complex)
|
|
|
|
|
2002-01-17 23:49:08 +03:00
|
|
|
#
|
|
|
|
# Use the ansi CXX compile flag for building cmake
|
|
|
|
#
|
2001-08-29 00:06:52 +04:00
|
|
|
IF (CMAKE_ANSI_CXXFLAGS)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
|
|
|
|
ENDIF (CMAKE_ANSI_CXXFLAGS)
|
2001-08-27 18:11:48 +04:00
|
|
|
|
2001-08-23 21:57:45 +04:00
|
|
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Include vars from a file and from a cache
|
|
|
|
#
|
2002-01-19 04:32:06 +03:00
|
|
|
IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
|
|
|
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
|
|
|
|
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
2001-08-23 21:57:45 +04:00
|
|
|
|
2002-01-22 23:50:52 +03:00
|
|
|
LOAD_CACHE(${Complex_SOURCE_DIR}/Cache
|
2002-01-20 08:12:27 +03:00
|
|
|
EXCLUDE
|
|
|
|
CACHE_TEST_VAR_EXCLUDED
|
|
|
|
INCLUDE_INTERNALS
|
|
|
|
CACHE_TEST_VAR_INTERNAL)
|
2002-01-19 03:21:43 +03:00
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Configure file
|
|
|
|
# (plug vars to #define so that they can be tested)
|
|
|
|
#
|
2001-08-23 21:57:45 +04:00
|
|
|
CONFIGURE_FILE(
|
2002-01-17 23:49:08 +03:00
|
|
|
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
|
|
|
|
${Complex_BINARY_DIR}/cmTestConfigure.h)
|
2001-08-23 21:57:45 +04:00
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Specify include and lib dirs
|
2002-01-20 08:12:27 +03:00
|
|
|
# (BEFORE is for coverage)
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
2001-08-23 21:57:45 +04:00
|
|
|
INCLUDE_DIRECTORIES(
|
2002-01-17 23:49:08 +03:00
|
|
|
${Complex_SOURCE_DIR}/Library
|
|
|
|
${Complex_SOURCE_DIR}/../../Source
|
2001-08-23 21:57:45 +04:00
|
|
|
)
|
2002-01-17 23:49:08 +03:00
|
|
|
|
2002-01-20 08:12:27 +03:00
|
|
|
INCLUDE_DIRECTORIES(BEFORE
|
|
|
|
${Complex_BINARY_DIR}
|
|
|
|
)
|
|
|
|
|
2002-01-20 09:58:57 +03:00
|
|
|
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*")
|
2002-01-20 05:24:55 +03:00
|
|
|
|
2001-08-23 21:57:45 +04:00
|
|
|
LINK_DIRECTORIES(
|
2002-01-17 23:49:08 +03:00
|
|
|
${Complex_BINARY_DIR}/Library
|
2001-08-23 21:57:45 +04:00
|
|
|
)
|
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Lib and exe path
|
|
|
|
#
|
2002-01-17 23:49:08 +03:00
|
|
|
SET (LIBRARY_OUTPUT_PATH
|
|
|
|
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
|
|
|
"Single output directory for building all libraries.")
|
|
|
|
|
|
|
|
SET (EXECUTABLE_OUTPUT_PATH
|
|
|
|
${Complex_BINARY_DIR}/bin/ CACHE PATH
|
|
|
|
"Single output directory for building all executables.")
|
|
|
|
|
|
|
|
#
|
2002-01-20 05:24:55 +03:00
|
|
|
# Create the libs and the main exe
|
2002-01-17 23:49:08 +03:00
|
|
|
#
|
|
|
|
SUBDIRS(Library Executable)
|
|
|
|
SUBDIR_DEPENDS(Executable Library)
|
|
|
|
|
2002-01-18 20:03:32 +03:00
|
|
|
#
|
2002-01-19 04:32:06 +03:00
|
|
|
# Exec program (TODO: test a result)
|
2002-01-18 20:03:32 +03:00
|
|
|
# Increase coverage.
|
|
|
|
#
|
2002-01-20 08:12:27 +03:00
|
|
|
MESSAGE("Trying to increase coverage...")
|
2002-01-19 04:32:06 +03:00
|
|
|
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
|
|
|
|
IF (NOT NO_EXEC_PROGRAM)
|
|
|
|
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
|
|
|
|
ELSE (NOT NO_EXEC_PROGRAM)
|
|
|
|
MESSAGE("Set this option ON")
|
|
|
|
ENDIF (NOT NO_EXEC_PROGRAM)
|
|
|
|
|
|
|
|
MARK_AS_ADVANCED(NO_EXEC_PROGRAM)
|
|
|
|
MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM)
|
2002-01-17 23:49:08 +03:00
|
|
|
|
2002-01-19 03:21:43 +03:00
|
|
|
#
|
|
|
|
# Create directory.
|
|
|
|
# The 'complex' executable will then test if this dir exists,
|
|
|
|
# sadly it won't be able to remove it.
|
|
|
|
#
|
|
|
|
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|