Skip to content

Commit

Permalink
Correctly link to the threads library when compiling with GCC
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiomarcias committed Jun 22, 2018
1 parent fad4e53 commit 85f9277
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Expand Up @@ -12,6 +12,13 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/DopeVector ${CMAKE_CURRENT_B
include(${CMAKE_CURRENT_SOURCE_DIR}/extern/DopeVector/sources_properties.cmake)


set(toLink DopeVector)
if(CMAKE_COMPILER_IS_GNUCXX)
find_package(Threads REQUIRED)
list(APPEND toLink Threads::Threads)
endif()



set(hdr_dir ${CMAKE_CURRENT_SOURCE_DIR}/include)

Expand All @@ -33,7 +40,7 @@ set(all_hdr ${hdr_inline_files} ${hdr_main_files})
add_library(${PROJECT_NAME} INTERFACE)

target_include_directories(${PROJECT_NAME} INTERFACE ${hdr_dir})
target_link_libraries(${PROJECT_NAME} INTERFACE DopeVector)
target_link_libraries(${PROJECT_NAME} INTERFACE ${toLink})

if(ATTACH_SOURCES)
target_sources(${PROJECT_NAME} INTERFACE ${all_hdr})
Expand Down

0 comments on commit 85f9277

Please sign in to comment.