COMP: Shorten ExportImport test command lines

The ExportImport test drives its Export and Import projects using the
same compiler and flags.  This converts the ctest --build-and-test
command lines to use an initial cache file instead of passing all
settings on the command line.

We need a shorter command line to pass through VS 6 on Win98.
This approach reduces duplicate code anyway.
This commit is contained in:
Brad King 2009-07-14 08:38:24 -04:00
parent 4d2dd55b9c
commit b44413f9f8
2 changed files with 20 additions and 22 deletions

View File

@ -22,20 +22,8 @@ else(CMAKE_CONFIGURATION_TYPES)
endif(CMAKE_BUILD_TYPE) endif(CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES) endif(CMAKE_CONFIGURATION_TYPES)
set(SAME_COMPILER configure_file(${ExportImport_SOURCE_DIR}/InitialCache.cmake.in
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} ${ExportImport_BINARY_DIR}/InitialCache.cmake @ONLY)
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
-DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
-DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL}
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_CXX_FLAGS_MINSIZEREL:STRING=${CMAKE_CXX_FLAGS_MINSIZEREL}
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
)
# Build and install the exporter. # Build and install the exporter.
add_custom_command( add_custom_command(
@ -49,10 +37,8 @@ add_custom_command(
--build-target install --build-target install
--build-generator ${CMAKE_GENERATOR} --build-generator ${CMAKE_GENERATOR}
--build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options ${SAME_COMPILER} --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake
-DCMAKE_INSTALL_PREFIX:STRING=${ExportImport_BINARY_DIR}/Root )
-DCMAKE_SKIP_RPATH:BOOL=ON
)
add_custom_target(ExportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ExportProject) add_custom_target(ExportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ExportProject)
add_dependencies(ExportTarget CleanupTarget) add_dependencies(ExportTarget CleanupTarget)
set_property( set_property(
@ -71,10 +57,8 @@ add_custom_command(
--build-project Import --build-project Import
--build-generator ${CMAKE_GENERATOR} --build-generator ${CMAKE_GENERATOR}
--build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options ${SAME_COMPILER} --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake
-DCMAKE_INSTALL_PREFIX:STRING=${ExportImport_BINARY_DIR}/Root )
-DCMAKE_SKIP_RPATH:BOOL=ON
)
add_custom_target(ImportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ImportProject) add_custom_target(ImportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ImportProject)
add_dependencies(ImportTarget ExportTarget) add_dependencies(ImportTarget ExportTarget)
set_property( set_property(

View File

@ -0,0 +1,14 @@
SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler")
SET(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags")
SET(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags")
SET(CMAKE_C_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@" CACHE STRING "C Flags")
SET(CMAKE_C_FLAGS_MINSIZEREL "@CMAKE_C_FLAGS_MINSIZEREL@" CACHE STRING "C Flags")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" CACHE STRING "C Flags")
SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE STRING "C++ Compiler")
SET(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@" CACHE STRING "C++ Flags")
SET(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@" CACHE STRING "C++ Flags")
SET(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@" CACHE STRING "C++ Flags")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@" CACHE STRING "C++ Flags")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" CACHE STRING "C++ Flags")
SET(CMAKE_INSTALL_PREFIX "@ExportImport_BINARY_DIR@/Root" CACHE STRING "Installation Prefix")
SET(CMAKE_SKIP_RPATH ON CACHE BOOL "No RPATH")