Skip to content

Commit

Permalink
Add test for include of ProjectCompilerPostConfig.cmake (TriBITSPub#207)
Browse files Browse the repository at this point in the history
This is a very strong yet very portable test that ensures that the file
cmake/ProjectCompilerPostConfig.cmake gets included and it is able to modify
CMAKE_CXX_FLAGS.
  • Loading branch information
bartlettroscoe committed Nov 30, 2017
1 parent 6fa3d69 commit e3d86d5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/core/ExamplesUnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2675,6 +2675,54 @@ IF (TribitsExampleProject_SimpleTpl_RPATH_CMAKE_SKIP_INSTALL_RPATH_run_NAMES
ENDIF()


#
# Test cmake/ProjectCompilerPostConfig.cmake
#

TRIBITS_ADD_ADVANCED_TEST( TribitsExampleProject_ProjectCompilerPostConfig
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
XHOSTTYPE Darwin

TEST_0
MESSAGE "Copy TribitsExampleProject so that we can copy in cmake/ProjectCompilerPostConfig.cmake."
CMND cp
ARGS -r ${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject .

TEST_1
MESSAGE "Copy in dummy cmake/ProjectCompilerPostConfig.cmake."
CMND cp
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/DummyProjectCompilerPostConfig.cmake
TribitsExampleProject/cmake/ProjectCompilerPostConfig.cmake

TEST_2
MESSAGE "Configure SimpleCxx and trace includes"
CMND ${CMAKE_COMMAND}
ARGS
${TribitsExampleProject_COMMON_CONFIG_ARGS}
-DTribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}
-DTribitsExProj_ENABLE_Fortran=OFF
-DTribitsExProj_ENABLE_DEBUG=OFF
-DTribitsExProj_TRACE_FILE_PROCESSING=ON
-DTribitsExProj_ENABLE_SimpleCxx=ON
TribitsExampleProject
PASS_REGULAR_EXPRESSION_ALL
"-- File Trace: PROJECT INCLUDE .*/cmake/ProjectCompilerPostConfig[.]cmake"
"Configuring done"
"Generating done"
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_3
MESSAGE "VERBOSE Build the simplecxx lib and verify that the new compiler flags is added "
CMND make
ARGS VERBOSE=1 simplecxx
PASS_REGULAR_EXPRESSION_ALL
"DDUMMY_DEFINE_JUST_TO_TSET_COMILER_POST_CONFIG"
ALWAYS_FAIL_ON_NONZERO_RETURN

)


########################################################################
# TribitsExampleProject + TribitsExampleProjectAddons
########################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDUMMY_DEFINE_JUST_TO_TSET_COMILER_POST_CONFIG")

0 comments on commit e3d86d5

Please sign in to comment.