Merge pull request #3110 from lrineau/Installation-better_check_headers-lrineau

Installation: better check_headers (for Travis)
This commit is contained in:
Laurent Rineau 2018-05-25 10:42:22 +02:00
commit e4ff486963
3 changed files with 31 additions and 11 deletions

View File

@ -1124,13 +1124,13 @@ because IPE_FOUND is false.")
endif() endif()
if(CGAL_ENABLE_CHECK_HEADERS) if(CGAL_ENABLE_CHECK_HEADERS)
set(falg "-fsyntax-only") set(flag "-fsyntax-only")
else() else()
set(falg "-E") set(flag "-E")
endif() endif()
if(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY) if(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY)
execute_process(COMMAND execute_process(COMMAND
${CMAKE_CXX_COMPILER} -x c++ ${falg} ${CGAL_MODULES_DIR}/config/support/test_syntaxonly.cpp ${CMAKE_CXX_COMPILER} -x c++ ${flag} ${CGAL_MODULES_DIR}/config/support/test_syntaxonly.cpp
ERROR_QUIET ERROR_QUIET
RESULT_VARIABLE ok) RESULT_VARIABLE ok)
if(ok EQUAL 0) if(ok EQUAL 0)
@ -1141,7 +1141,7 @@ because IPE_FOUND is false.")
endif(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY) endif(NOT DEFINED CGAL_CHECK_SYNTAX_ONLY)
if(NOT CGAL_CHECK_SYNTAX_ONLY) if(NOT CGAL_CHECK_SYNTAX_ONLY)
message(FATAL_ERROR "Your compiler does not seem to support ${falg}. message(FATAL_ERROR "Your compiler does not seem to support ${flag}.
You must disable CGAL_ENABLE_CHECK_HEADERS.") You must disable CGAL_ENABLE_CHECK_HEADERS.")
endif() endif()
@ -1279,7 +1279,16 @@ LEDA_FOUND is false.")
separate_arguments(CMD separate_arguments(CMD
UNIX_COMMAND UNIX_COMMAND
"${CMAKE_CXX_COMPILER} ${compile_options_str} "${CMAKE_CXX_COMPILER} ${compile_options_str}
${include_options_str} -x c++ ${falg} -H \ ${include_options_str} -x c++ ${flag} -H \
${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
# The header Algebraic_kernel_rs_gmpz_d_1.h is skipped on purpose: it
# depends on RS.
)
# CMD2 is CMD without the -H option
separate_arguments(CMD2
UNIX_COMMAND
"${CMAKE_CXX_COMPILER} ${compile_options_str}
${include_options_str} -x c++ ${flag} \
${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
# The header Algebraic_kernel_rs_gmpz_d_1.h is skipped on purpose: it # The header Algebraic_kernel_rs_gmpz_d_1.h is skipped on purpose: it
# depends on RS. # depends on RS.
@ -1290,6 +1299,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}"
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DCERR:STRING=${chk_header_name} -DCERR:STRING=${chk_header_name}
"-DCMD:STRING=${CMD}" "-DCMD:STRING=${CMD}"
"-DCMD2:STRING=${CMD2}"
-P "${CGAL_MODULES_DIR}/run_cmd_redirection_cerr.cmake" -P "${CGAL_MODULES_DIR}/run_cmd_redirection_cerr.cmake"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}
DEPENDS ${CGAL_MODULES_DIR}/run_cmd_redirection_cerr.cmake DEPENDS ${CGAL_MODULES_DIR}/run_cmd_redirection_cerr.cmake

View File

@ -15,15 +15,24 @@ if(NOT CERR)
"The variable `CERR` should be defined to the output error file!") "The variable `CERR` should be defined to the output error file!")
endif() endif()
# Create the file before using it
file(WRITE ${CERR})
# Execute the command ${CMD} with stderr redirected to the file ${CERR}
execute_process( execute_process(
COMMAND ${CMD} COMMAND ${CMD}
ERROR_VARIABLE err ERROR_FILE "${CERR}"
OUTPUT_VARIABLE output OUTPUT_VARIABLE output
RESULT_VARIABLE error_result) RESULT_VARIABLE error_result)
file(WRITE ${CERR} "${err}")
if(error_result) if(error_result)
if(CMD2)
file(REMOVE ${CERR})
execute_process(COMMAND ${CMD2})
message(SEND_ERROR)
else()
file(READ ${CERR} err)
file(REMOVE ${CERR})
string(REPLACE ";" " " CMD_STR "${CMD}") string(REPLACE ";" " " CMD_STR "${CMD}")
message(SEND_ERROR message(SEND_ERROR
"The command "The command
@ -35,3 +44,4 @@ and the following error output:
${err}" ${err}"
) )
endif() endif()
endif()

View File

@ -29,7 +29,7 @@ do
done done
cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++11" .. cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++11" ..
make -j$(nproc --all) packages_dependencies make -j$(nproc --all) -k packages_dependencies
echo " Checks finished" echo " Checks finished"
for pkg_path in $CGAL_ROOT/* for pkg_path in $CGAL_ROOT/*
do do