Skip to content

Commit d08abf9

Browse files
committed
Respect FINEFTP_SERVER_USE_BUILTIN_ASIO
Fix asio cmake to take FINEFTP_SERVER_USE_BUILTIN_ASIO into account
1 parent bbd4e0e commit d08abf9

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

fineftp-server/CMakeLists.txt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
1111
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
1212

1313
find_package(Threads REQUIRED)
14-
find_package(asio REQUIRED)
14+
if (FINEFTP_SERVER_USE_BUILTIN_ASIO)
15+
find_package(asio REQUIRED)
16+
endif()
1517

1618
# Include GenerateExportHeader that will create export macros for us
1719
include(GenerateExportHeader)
@@ -65,18 +67,22 @@ generate_export_header(${PROJECT_NAME}
6567

6668
add_library (fineftp::server ALIAS ${PROJECT_NAME})
6769

68-
6970
target_link_libraries(${PROJECT_NAME}
70-
PRIVATE
71-
Threads::Threads
72-
$<$<BOOL:${WIN32}>:ws2_32>
73-
$<$<BOOL:${WIN32}>:wsock32>
74-
75-
# Link header-only libs (asio & recycle) as described in this workaround:
76-
# https://gitlab.kitware.com/cmake/cmake/-/issues/15415#note_633938
77-
$<BUILD_INTERFACE:asio::asio>
71+
PRIVATE
72+
Threads::Threads
73+
$<$<BOOL:${WIN32}>:ws2_32>
74+
$<$<BOOL:${WIN32}>:wsock32>
7875
)
7976

77+
if (FINEFTP_SERVER_USE_BUILTIN_ASIO)
78+
target_link_libraries(${PROJECT_NAME}
79+
PRIVATE
80+
# Link header-only libs (asio & recycle) as described in this workaround:
81+
# https://gitlab.kitware.com/cmake/cmake/-/issues/15415#note_633938
82+
$<BUILD_INTERFACE:asio::asio>
83+
)
84+
endif()
85+
8086
target_compile_definitions(${PROJECT_NAME}
8187
PRIVATE
8288
ASIO_STANDALONE

0 commit comments

Comments
 (0)