diff --git a/CMakeLists.txt b/CMakeLists.txt index ba73aea2a..fd9971dcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,10 +52,15 @@ if(WITH_HIVE) set(WITH_SHARED ON) endif() +include(CheckCXXSourceCompiles) +include(CheckLibraryExists) + include(cmake/target_link_libraries_system.cmake) include(cmake/add_import_library.cmake) include(cmake/add_log_tag.cmake) include(cmake/libatomic.cmake) +include(cmake/check_for_std_optional.cmake) +include(cmake/check_for_std_filesystem.cmake) if (STATIC_LINK AND STATIC_LINK_RUNTIME) message(FATAL "Cannot set both STATIC_LINK and STATIC_LINK_RUNTIME") diff --git a/cmake/check_for_std_optional.cmake b/cmake/check_for_std_optional.cmake new file mode 100644 index 000000000..5bb712cee --- /dev/null +++ b/cmake/check_for_std_optional.cmake @@ -0,0 +1,18 @@ +# check for std::optional because macos is broke af sometimes + +set(std_optional_code [[ +#include + +int main() { + std::optional maybe; + maybe = 1; + return maybe.value() == 1; +} +]]) + +check_cxx_source_compiles("${std_optional_code}" was_compiled) +if(was_compiled) + message(STATUS "we have std::optional") +else() + message(FATAL_ERROR "we dont have std::optional your compiler is broke af") +endif() diff --git a/cmake/unix.cmake b/cmake/unix.cmake index 7888a69a6..932d256bf 100644 --- a/cmake/unix.cmake +++ b/cmake/unix.cmake @@ -2,9 +2,6 @@ if(NOT UNIX) return() endif() -include(CheckCXXSourceCompiles) -include(CheckLibraryExists) - # can't have UNIX defined # can't have the include paths for libuv either? if(NOT IOS AND NOT ANDROID AND NOT WIN32) @@ -76,8 +73,6 @@ endif() set(EXE_LIBS ${STATIC_LIB}) -include(check_for_std_filesystem) - if(RELEASE_MOTTO) add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}") endif()