diff options
author | Gereon Kremer <gereon.kremer@cs.rwth-aachen.de> | 2021-03-31 23:17:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 21:17:38 +0000 |
commit | f9a9af855fb65804ff0b36e764ccd9d0fa9f87f8 (patch) | |
tree | 2c90b0e704366541187198231102b2d1eed26f41 /cmake/deps-helper.cmake | |
parent | 39ea1d8a1497a83d1efc649bd10da82916e5db5f (diff) |
Refactor GMP and Poly dependencies (#6245)
Refactors GMP and libpoly to also use external projects and be available within cmake as proper targets.
Diffstat (limited to 'cmake/deps-helper.cmake')
-rw-r--r-- | cmake/deps-helper.cmake | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/cmake/deps-helper.cmake b/cmake/deps-helper.cmake index bdc3e5de1..4b88d62ce 100644 --- a/cmake/deps-helper.cmake +++ b/cmake/deps-helper.cmake @@ -23,28 +23,46 @@ endmacro(check_system_version) # we are cross compiling if # - CMAKE_SYSTEM_NAME has been changed to ${name} # - CMAKE_SYSTEM_PROCESSOR has been changed to ${processor} -function(fail_if_cross_compiling name processor target error) - set(FAIL FALSE) +function(check_if_cross_compiling OUT name processor) if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") if(NOT "${name}" STREQUAL "") if("${CMAKE_SYSTEM_NAME}" STREQUAL "${name}") - set(FAIL TRUE) + set(${OUT} TRUE PARENT_SCOPE) + return() endif() endif() endif() if(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}") if(NOT "${processor}" STREQUAL "") if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${processor}") - set(FAIL TRUE) + set(${OUT} TRUE PARENT_SCOPE) + return() endif() endif() endif() + set(${OUT} FALSE PARENT_SCOPE) +endfunction(check_if_cross_compiling) + +# fail if we are cross compiling as indicated by name and processor +# we are cross compiling if +# - CMAKE_SYSTEM_NAME has been changed to ${name} +# - CMAKE_SYSTEM_PROCESSOR has been changed to ${processor} +function(fail_if_cross_compiling name processor target error) + check_if_cross_compiling(FAIL "${name}" "${processor}") if(FAIL) message(SEND_ERROR - "We are cross compiling from \ + "We are cross compiling from \ ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR} to \ ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}.\n" - "This is not supported by ${target}:\n" - "${error}") + "This is not supported by ${target}:\n" + "${error}") endif() endfunction(fail_if_cross_compiling) + +function(fail_if_include_missing include target) + include(CheckIncludeFileCXX) + check_include_file_cxx(${include} HAVE_INCLUDE) + if(NOT HAVE_INCLUDE) + message(SEND_ERROR "${target} requires ${include} header, but it is not available.") + endif() +endfunction(fail_if_include_missing) |