Fix CMakeLists.txt

This commit is contained in:
Atsushi Togo 2022-11-14 13:10:24 +09:00
parent cf1a4279de
commit d091824acb
1 changed files with 9 additions and 4 deletions

View File

@ -33,10 +33,14 @@ else()
set(MY_INCLUDES ${PROJECT_SOURCE_DIR}/c)
endif()
find_package(OpenMP)
if (OpenMP_FOUND)
option(USE_OpenMP "Option to search OpenMP library" ON)
if (USE_OpenMP)
message(STATUS "Find OpenMP library")
find_package(OpenMP)
if (OpenMP_FOUND)
message(STATUS "OpenMP libs: ${OpenMP_C_LIBRARIES}")
message(STATUS "OpenMP flags: ${OpenMP_C_FLAGS}")
endif()
endif()
if (PHONO3PY OR PHONONMOD)
@ -190,12 +194,12 @@ if (GRIDSYS)
${PROJECT_SOURCE_DIR}/c/triplet_grid.c
${PROJECT_SOURCE_DIR}/c/triplet_iw.c)
if (BUILD_SHARED_LIBRARIES)
# Shared library
add_library(gridsysmod SHARED ${SOURCES_GRIDSYSMOD})
target_link_libraries(gridsysmod m ${OpenMP_C_LIBRARIES})
target_include_directories(gridsysmod PRIVATE ${MY_INCLUDES})
target_compile_options(gridsysmod PRIVATE ${OpenMP_C_FLAGS})
target_compile_definitions(gridsysmod PRIVATE THM_EPSILON=1e-10)
set_property(TARGET gridsysmod PROPERTY VERSION ${serial})
set_property(TARGET gridsysmod PROPERTY SOVERSION ${soserial})
@ -206,7 +210,8 @@ if (GRIDSYS)
add_library(gridsysmod_static STATIC ${SOURCES_GRIDSYSMOD})
target_link_libraries(gridsysmod_static m ${OpenMP_C_LIBRARIES})
target_include_directories(gridsysmod_static PRIVATE ${MY_INCLUDES})
target_compile_definitions(gridsysmod PRIVATE THM_EPSILON=1e-10)
target_compile_options(gridsysmod_static PRIVATE ${OpenMP_C_FLAGS})
target_compile_definitions(gridsysmod_static PRIVATE THM_EPSILON=1e-10)
set_property(TARGET gridsysmod_static PROPERTY VERSION ${serial})
set_property(TARGET gridsysmod_static PROPERTY SOVERSION ${soserial})
set_property(TARGET gridsysmod_static PROPERTY OUTPUT_NAME gridsysmod)