Skip to content

Commit 4d35bff

Browse files
committed
ver 3.2: fix ADDBOOSTCMAKE_LINK_TYPE
1 parent d33f28e commit 4d35bff

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

CMakeLists.txt

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.14...3.22)
55
# Note: update this to your new project's name and version
66
project(
77
AddBoost.cmake
8-
VERSION 3.1
8+
VERSION 3.2
99
LANGUAGES CXX
1010
)
1111

@@ -168,22 +168,24 @@ macro(add_boost TRY_BOOST_VERSION BOOST_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED
168168
if(NOT DEFINED ADDBOOSTCMAKE_LINK_TYPE)
169169
get_target_property(type ${target} TYPE)
170170
if("${type}" STREQUAL "INTERFACE_LIBRARY")
171-
set(ADDBOOSTCMAKE_LINK_TYPE "INTERFACE")
171+
set(ADDBOOSTCMAKE_LINK_TYPE_VALUE "INTERFACE")
172172
else()
173-
set(ADDBOOSTCMAKE_LINK_TYPE "PUBLIC")
173+
set(ADDBOOSTCMAKE_LINK_TYPE_VALUE "PUBLIC")
174174
endif()
175+
else()
176+
set(ADDBOOSTCMAKE_LINK_TYPE_VALUE ${ADDBOOSTCMAKE_LINK_TYPE})
175177
endif()
176178
if(Boost_ADDED STREQUAL "")
177-
target_link_libraries(${target} ${ADDBOOSTCMAKE_LINK_TYPE} Boost::boost)
179+
target_link_libraries(${target} ${ADDBOOSTCMAKE_LINK_TYPE_VALUE} Boost::boost)
178180
else()
179181
foreach(a_lib ${${BOOST_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED}})
180-
target_link_libraries(${target} ${ADDBOOSTCMAKE_LINK_TYPE}
182+
target_link_libraries(${target} ${ADDBOOSTCMAKE_LINK_TYPE_VALUE}
181183
Boost::${a_lib})
182184
endforeach()
183185
endif()
184186

185187
foreach(a_lib ${${BOOST_NOT_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED}})
186-
target_link_libraries(${target} ${ADDBOOSTCMAKE_LINK_TYPE}
188+
target_link_libraries(${target} ${ADDBOOSTCMAKE_LINK_TYPE_VALUE}
187189
Boost::${a_lib})
188190
endforeach()
189191
endforeach()

0 commit comments

Comments
 (0)