Improve on C flag setup and support OpenMP

fixes-turtlebasket
Mattia 2020-05-03 23:27:21 +01:00
parent bb635ee3da
commit 73a5aae3cd
2 changed files with 7 additions and 9 deletions

View File

@ -62,17 +62,15 @@ ENDIF(BUILD_STATIC_LIB)
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER ${SOURCE_HEADS}) set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER ${SOURCE_HEADS})
# PLATFORM-SPECIFIC SETTING
if (UNIX)
find_library(M_LIB m)
set(CMAKE_C_FLAGS "-lm")
else ()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif ()
# ADD DEFAULT COMPILER FLAGS # ADD DEFAULT COMPILER FLAGS
include(CompilerFlags) include(CompilerFlags)
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
# Link include file # Link include file
target_include_directories( ${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories( ${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")

View File

@ -32,7 +32,7 @@
# PLATFORM-SPECIFIC SETTING # PLATFORM-SPECIFIC SETTING
if (UNIX) if (UNIX)
find_library(M_LIB m) find_library(M_LIB m)
set(CMAKE_C_FLAGS "-lm") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lm")
else () else ()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif () endif ()