Skip to content

Commit 7df08ff

Browse files
committed
Do not link to OpenMP if it is not found
1 parent fad5aad commit 7df08ff

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/flacarray/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ set(libflcarr_HEADERS
2525

2626
add_library(flcarr OBJECT ${libflcarr_SOURCES})
2727

28-
target_compile_options(flcarr PRIVATE "${OpenMP_C_FLAGS}")
29-
3028
target_include_directories(flcarr BEFORE PUBLIC
3129
"${CMAKE_CURRENT_SOURCE_DIR}/libflacarray"
3230
)
3331

3432
target_include_directories(flcarr PUBLIC "${FLAC_INCLUDE_DIRS}")
3533
target_link_libraries(flcarr PUBLIC "${FLAC_LIBRARIES}")
3634

37-
target_link_libraries(flcarr PUBLIC "${OpenMP_C_LIBRARIES}")
35+
if(OpenMP_C_Found)
36+
target_compile_options(flcarr PRIVATE "${OpenMP_C_FLAGS}")
37+
target_link_libraries(flcarr PUBLIC "${OpenMP_C_LIBRARIES}")
38+
endif()
3839

3940
# Create an shared library, usable by external compiled software
4041

src/flacarray/scripts/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Install python files
22

33
set(CONF_EXTRA_LIBS "${FLAC_LIBRARIES}")
4-
set(CONF_EXTRA_FLAGS "${OpenMP_C_FLAGS}")
4+
if(OpenMP_C_FOUND)
5+
set(CONF_EXTRA_FLAGS "${OpenMP_C_FLAGS}")
6+
else()
7+
set(CONF_EXTRA_FLAGS "")
8+
endif()
59

610
configure_file(
711
"${CMAKE_CURRENT_SOURCE_DIR}/config.py.in" # Input file path

0 commit comments

Comments
 (0)