Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

include(CheckRequiredCompilerFeatures)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

option(OCCA_ENABLE_OPENMP "Build with OpenMP if available" ON)
Expand Down Expand Up @@ -80,12 +82,6 @@ if (OCCA_CLANG_BASED_TRANSPILER)
endif()

include(SetCompilerFlags)
include(CheckCXXCompilerFlag)

check_cxx_compiler_flag("-fno-strict-aliasing" COMPILER_SUPPORTS_NO_STRICT_ALIASING)
if(COMPILER_SUPPORTS_NO_STRICT_ALIASING)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
endif()

string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
message("-- System : ${CMAKE_SYSTEM}")
Expand Down
15 changes: 15 additions & 0 deletions cmake/CheckRequiredCompilerFeatures.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include(CheckCXXCompilerFlag)

check_cxx_source_compiles("
#include <filesystem>

namespace fs = std::filesystem;

int main(int argc, char *argv[]) {
return 0;
}
" HAS_FILE_SYSTEM)

if (NOT HAS_FILE_SYSTEM)
message(FATAL_ERROR "CXX compiler doesn't have std::filesystem support !")
endif()
5 changes: 5 additions & 0 deletions cmake/SetCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ if (OCCA_ENABLE_FORTRAN)
set_optional_fortran_flag(SUPPORTED_WNO_INTEGER_DIVISION_Fortran_FLAGS "-Wno-integer-division")

endif()

check_cxx_compiler_flag("-fno-strict-aliasing" COMPILER_SUPPORTS_NO_STRICT_ALIASING)
if(COMPILER_SUPPORTS_NO_STRICT_ALIASING)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
endif()