ENH: Added test for generated header included by non-generated source.

This commit is contained in:
Brad King 2002-12-13 17:35:00 -05:00
parent 4cbcd08594
commit 526649127e
12 changed files with 75 additions and 9 deletions

View File

@ -61,7 +61,7 @@ INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*")
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" "^$")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library

View File

@ -3,8 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 1.3)
# Create exe.
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS
"-DFILE_HAS_EXTRA_COMPILE_FLAGS")
# Link to CMake lib
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source)
# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
@ -22,6 +21,21 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
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}
)
#
# Output the files required by 'complex' to a file.
#

View File

@ -1,5 +1,6 @@
#include "cmTestConfigure.h"
#include "cmTestConfigureEscape.h"
#include "cmTestGeneratedHeader.h"
#include "cmVersion.h"
#include "ExtraSources/file1.h"
#include "file2.h"
@ -808,6 +809,12 @@ int main()
#else
cmFailed("IF inside a FOREACH block is broken");
#endif
#if defined(GENERATED_HEADER_INCLUDED)
cmPassed("Generated header included by non-generated source works.");
#else
cmFailed("Generated header included by non-generated source failed.");
#endif
#ifdef FORCE_TEST
cmFailed("CMake SET CACHE FORCE");

View File

@ -0,0 +1 @@
#define GENERATED_HEADER_INCLUDED

View File

@ -61,7 +61,7 @@ INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*")
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" "^$")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library

View File

@ -3,8 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 1.3)
# Create exe.
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS
"-DFILE_HAS_EXTRA_COMPILE_FLAGS")
# Link to CMake lib
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source)
# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
@ -22,6 +21,21 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
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}
)
#
# Output the files required by 'complex' to a file.
#

View File

@ -1,5 +1,6 @@
#include "cmTestConfigure.h"
#include "cmTestConfigureEscape.h"
#include "cmTestGeneratedHeader.h"
#include "cmVersion.h"
#include "ExtraSources/file1.h"
#include "file2.h"
@ -808,6 +809,12 @@ int main()
#else
cmFailed("IF inside a FOREACH block is broken");
#endif
#if defined(GENERATED_HEADER_INCLUDED)
cmPassed("Generated header included by non-generated source works.");
#else
cmFailed("Generated header included by non-generated source failed.");
#endif
#ifdef FORCE_TEST
cmFailed("CMake SET CACHE FORCE");

View File

@ -0,0 +1 @@
#define GENERATED_HEADER_INCLUDED

View File

@ -61,7 +61,7 @@ INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*")
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" "^$")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library

View File

@ -3,8 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 1.3)
# Create exe.
#
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS
"-DFILE_HAS_EXTRA_COMPILE_FLAGS")
# Link to CMake lib
LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source)
# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to
@ -22,6 +21,21 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
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}
)
#
# Output the files required by 'complex' to a file.
#

View File

@ -1,5 +1,6 @@
#include "cmTestConfigure.h"
#include "cmTestConfigureEscape.h"
#include "cmTestGeneratedHeader.h"
#include "cmVersion.h"
#include "ExtraSources/file1.h"
#include "file2.h"
@ -808,6 +809,12 @@ int main()
#else
cmFailed("IF inside a FOREACH block is broken");
#endif
#if defined(GENERATED_HEADER_INCLUDED)
cmPassed("Generated header included by non-generated source works.");
#else
cmFailed("Generated header included by non-generated source failed.");
#endif
#ifdef FORCE_TEST
cmFailed("CMake SET CACHE FORCE");

View File

@ -0,0 +1 @@
#define GENERATED_HEADER_INCLUDED