jrmadsen / PTL

Parallel Tasking Library (PTL) - Lightweight C++11 mutilthreading tasking system featuring thread-pool, task-groups, and lock-free task queue
MIT License
43 stars 13 forks source link

Support for BUILD_OBJECT_LIBS #28

Closed jrmadsen closed 2 years ago

jrmadsen commented 2 years ago

Example

set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

# ...

# these will be propagated down to PTL
set(BUILD_SHARED_LIBS OFF)
set(BUILD_STATIC_LIBS OFF)
set(BUILD_OBJECT_LIBS ON)

add_subdirectory(external/PTL)

# create an interface lib for using PTL
add_library(foo-ptl INTERFACE)
# provide ptl object files as sources
target_sources(foo-ptl INTERFACE $<TARGET_OBJECTS:PTL::ptl-object>)
# propagate the include dirs, etc.
target_link_libraries(foo-ptl INTERFACE PTL::ptl-object)

# ...

add_library(foo SHARED)
target_link_libraries(foo PRIVATE foo-ptl)