Compare commits
2 Commits
7cb811e4d1
...
2f3f45f2a0
Author | SHA1 | Date | |
---|---|---|---|
2f3f45f2a0 | |||
7c22ac6b82 |
@@ -30,6 +30,7 @@ include(CMLibLSBInfo)
|
|||||||
include(CMLibCompiler)
|
include(CMLibCompiler)
|
||||||
include(CMLibCompilerFlags)
|
include(CMLibCompilerFlags)
|
||||||
include(CMLibDistCC)
|
include(CMLibDistCC)
|
||||||
|
include(CMLibHighPrecisionMath)
|
||||||
include(CMLibGenerateCompilerFeaturesHPP)
|
include(CMLibGenerateCompilerFeaturesHPP)
|
||||||
include(CMLibFlagRemove)
|
include(CMLibFlagRemove)
|
||||||
include(CMLibCotire)
|
include(CMLibCotire)
|
||||||
|
@@ -4,15 +4,15 @@ function(add_common_library target)
|
|||||||
set(oneValueArgs OUTPUT_NAME)
|
set(oneValueArgs OUTPUT_NAME)
|
||||||
set(multiValueArgs SOURCES)
|
set(multiValueArgs SOURCES)
|
||||||
|
|
||||||
cmake_parse_arguments(_LOCAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(_PREFIX "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
if(_LOCAL_OUTPUT_NAME)
|
if(_PREFIX_OUTPUT_NAME)
|
||||||
set(output_name ${_LOCAL_OUTPUT_NAME})
|
set(output_name ${_PREFIX_OUTPUT_NAME})
|
||||||
else()
|
else()
|
||||||
set(output_name ${target})
|
set(output_name ${target})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${target} OBJECT ${_LOCAL_SOURCES})
|
add_library(${target} OBJECT ${_PREFIX_SOURCES})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/${target}>)
|
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/${target}>)
|
||||||
|
40
CMLibHighPrecisionMath.cmake
Normal file
40
CMLibHighPrecisionMath.cmake
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
function(enable_high_precision_math)
|
||||||
|
set(options QUAD MPFR)
|
||||||
|
set(oneValueArgs)
|
||||||
|
set(multiValueArgs)
|
||||||
|
|
||||||
|
cmake_parse_arguments(_PREFIX "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(_PREFIX_MPFR AND _PREFIX_QUAD)
|
||||||
|
message(FATAL_ERROR "Mutually exclusive options QUAD and MPFR")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_PREFIX_MPFR)
|
||||||
|
find_package(MPFR)
|
||||||
|
if(MPFR_FOUND)
|
||||||
|
find_package(MPFRCppThirdparty)
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_PREFIX_QUAD)
|
||||||
|
find_package(Quadmath)
|
||||||
|
if(QUADMATH_FOUND)
|
||||||
|
add_definitions(-DHAVE_QUADMATH=1)
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Default
|
||||||
|
find_package(Quadmath)
|
||||||
|
if(QUADMATH_FOUND)
|
||||||
|
add_definitions(-DHAVE_QUADMATH=1)
|
||||||
|
else()
|
||||||
|
find_package(MPFR)
|
||||||
|
if(MPFR_FOUND)
|
||||||
|
find_package(MPFRCppThirdparty)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
Reference in New Issue
Block a user