Skip to content

Commit c26f435

Browse files
committed
build: adjust linking visibility for exported targets
Make BlocksRuntime public rather than private since the public headers reference `Blocks.h` making the users dependent on BlocksRuntime, requiring the explicit link. This also enables the use of the export targets to automatically setup the include paths for users.
1 parent e731c22 commit c26f435

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/BlocksRuntime/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
1212
endif()
1313
endif()
1414

15-
set_target_properties(BlocksRuntime PROPERTIES
16-
POSITION_INDEPENDENT_CODE TRUE
17-
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
15+
target_include_directories(BlocksRuntime PUBLIC
16+
${CMAKE_CURRENT_SOURCE_DIR})
1817
if(HAVE_OBJC AND CMAKE_DL_LIBS)
1918
target_link_libraries(BlocksRuntime PUBLIC
2019
${CMAKE_DL_LIBS})
2120
endif()
2221

22+
set_target_properties(BlocksRuntime PROPERTIES
23+
POSITION_INDEPENDENT_CODE TRUE)
24+
2325
add_library(BlocksRuntime::BlocksRuntime ALIAS BlocksRuntime)
2426

2527
install(FILES Block.h

src/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,13 @@ endif()
9595
set_target_properties(dispatch PROPERTIES
9696
POSITION_INDEPENDENT_CODE YES)
9797

98-
target_include_directories(dispatch PRIVATE
98+
target_include_directories(dispatch PUBLIC
9999
${PROJECT_BINARY_DIR}
100100
${PROJECT_SOURCE_DIR}
101101
${CMAKE_CURRENT_SOURCE_DIR}
102-
${CMAKE_CURRENT_BINARY_DIR}
102+
${CMAKE_CURRENT_BINARY_DIR})
103+
target_include_directories(dispatch PRIVATE
103104
${PROJECT_SOURCE_DIR}/private)
104-
target_include_directories(dispatch SYSTEM BEFORE PRIVATE
105-
"${BlocksRuntime_INCLUDE_DIR}")
106105

107106
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
108107
target_compile_definitions(dispatch PRIVATE
@@ -137,7 +136,8 @@ if(LibRT_FOUND)
137136
target_link_libraries(dispatch PRIVATE RT::rt)
138137
endif()
139138
target_link_libraries(dispatch PRIVATE
140-
Threads::Threads
139+
Threads::Threads)
140+
target_link_libraries(dispatch PUBLIC
141141
BlocksRuntime::BlocksRuntime)
142142
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
143143
target_link_libraries(dispatch PRIVATE

0 commit comments

Comments
 (0)