Unify CGAL_HEADER_ONLY and CGAL_HEADER_ONLY_STEP_2

This commit is contained in:
Laurent Rineau 2017-11-23 16:44:11 +01:00
parent bec5f9aae1
commit a2a5ca91a1
7 changed files with 30 additions and 21 deletions

View File

@ -1,5 +1,5 @@
#
# This file points to the CGALConfig.cmake for a pure header-only
# This file points to the CGALConfig.cmake for a header-only
# CGAL installation.
#

View File

@ -36,7 +36,7 @@ if(CMAKE_MAJOR_VERSION GREATER 2)
# In header only mode, we use INTERFACE libraries, which was introduced in cmake 3.0.
# Thus this option is only enabled for cmake >= 3.0.
if (CGAL_HEADER_ONLY OR CGAL_HEADER_ONLY_STEP_2)
if (CGAL_HEADER_ONLY)
set(CGAL_HEADER_ONLY TRUE CACHE BOOL "Enable cgal header only" FORCE)
add_definitions(-DCGAL_HEADER_ONLY)
endif()
@ -666,7 +666,7 @@ option( CGAL_ENABLE_PRECONFIG "Select to allow to preconfiguration of external l
# this; e.g. in MPFI/RS in Algebraic_kernel_d. For these cases CGAL
# and the example/test must be configured with MPFI (just one is not sufficient)
if(NOT CGAL_HEADER_ONLY_STEP_2)
if(NOT CGAL_HEADER_ONLY)
include(CGAL_SetupDependencies)
endif()
@ -678,7 +678,7 @@ message("== Detect external libraries (DONE) ==\n")
#
#--------------------------------------------------------------------------------------------------
if(NOT CGAL_HEADER_ONLY_STEP_2)
if(NOT CGAL_HEADER_ONLY)
# The variables set are the #defines expected by compiler_config.h
# Note: CMake will not notice when files are added or removed
# but this is probably OK for the installation procedure.
@ -740,7 +740,7 @@ endif()
message("== Write compiler_config.h (DONE) ==\n")
endif(NOT CGAL_HEADER_ONLY_STEP_2)
endif(NOT CGAL_HEADER_ONLY)
#--------------------------------------------------------------------------------------------------
#
@ -847,7 +847,12 @@ if (CGAL_BRANCH_BUILD AND CGAL_REPORT_DUPLICATE_FILES )
endif()
create_CGALconfig_files()
if(NOT CGAL_HEADER_ONLY)
create_CGALconfig_files()
else()
configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary_header_only.cmake.in"
"${CMAKE_BINARY_DIR}/CGALConfig.cmake" @ONLY)
endif()
#--------------------------------------------------------------------------------------------------
#
@ -892,7 +897,7 @@ if ( ZLIB_IN_AUXILIARY )
endif()
if(NOT CGAL_HEADER_ONLY_STEP_2)
if(NOT CGAL_HEADER_ONLY)
install(FILES
${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake
${CMAKE_BINARY_DIR}/config/CGALConfig.cmake

View File

@ -0,0 +1,5 @@
#
# This file points to the CGALConfig.cmake for header-only CGAL.
#
include(@CGAL_INSTALLATION_PACKAGE_DIR@/lib/cmake/CGAL/CGALConfig.cmake)

View File

@ -139,7 +139,7 @@
// platform specific workaround flags (CGAL_CFG_...)
//----------------------------------------------------------------------//
#if CGAL_HEADER_ONLY_STEP_2
#if CGAL_HEADER_ONLY
# include <CGAL/internal/enable_third_party_libraries.h>
# if(BOOST_MSVC)
# include <CGAL/MSVC_compiler_config.h>

View File

@ -1,12 +1,12 @@
#
# This file is the CGALConfig.cmake for a pure header-only CGAL installation
# This file is the CGALConfig.cmake for a header-only CGAL installation
#
if(CGALConfig_included)
return()
endif()
message(STATUS "Using pure header-only CGAL")
message(STATUS "Using header-only CGAL")
set(CGALConfig_included TRUE)
@ -105,7 +105,7 @@ foreach(cgal_lib ${CGAL_LIBRARIES})
endforeach()
target_compile_definitions(CGAL INTERFACE CGAL_HEADER_ONLY=1)
target_compile_definitions(CGAL INTERFACE CGAL_HEADER_ONLY_STEP_2=1)
#
#

View File

@ -10,8 +10,8 @@ endif()
CGAL_setup_CGAL_dependencies(CGAL ${keyword})
if(CGAL_HEADER_ONLY_STEP_2)
target_compile_definitions(CGAL INTERFACE CGAL_HEADER_ONLY_STEP_2=1)
if(CGAL_HEADER_ONLY)
target_compile_definitions(CGAL INTERFACE CGAL_HEADER_ONLY=1)
endif()
if(NOT CGAL_DISABLE_GMP)

View File

@ -94,15 +94,14 @@ function (collect_cgal_library LIBRARY_NAME ADDITIONAL_FILES)
install(EXPORT ${LIBRARY_NAME}Exports
DESTINATION "${CGAL_INSTALL_CMAKE_DIR}"
NAMESPACE CGAL::)
# We have to call configure_file twice to force double expansion of variables.
configure_file("${CGAL_MODULES_DIR}/CGALLibConfig.cmake.in"
"${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
configure_file("${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake"
"${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
endif()
# We have to call configure_file twice to force double expansion of variables.
configure_file("${CGAL_MODULES_DIR}/CGALLibConfig.cmake.in"
"${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
configure_file("${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake"
"${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}LibConfig.cmake" DESTINATION ${CGAL_INSTALL_CMAKE_DIR})
endfunction()
function( configure_component DIR COMPONENT )