Skip to content

Commit af52a80

Browse files
committed
CML: add headers as source only if cmake >= 3.19
1 parent b31bee2 commit af52a80

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,17 @@ endif ()
140140
file(GLOB_RECURSE BOOST_OPENMETHOD_HEADERS CONFIGURE_DEPENDS include/boost/*.hpp)
141141
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
142142
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_OPENMETHOD_HEADERS})
143+
143144
function(boost_openmethod_setup_properties target)
144145
target_link_libraries(${target} INTERFACE ${BOOST_OPENMETHOD_DEPENDENCIES})
145146
endfunction()
146147

147-
add_library(boost_openmethod INTERFACE ${BOOST_OPENMETHOD_HEADERS})
148+
add_library(boost_openmethod INTERFACE)
149+
150+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
151+
target_sources(boost_openmethod PRIVATE ${BOOST_OPENMETHOD_HEADERS})
152+
endif()
153+
148154
add_library(Boost::openmethod ALIAS boost_openmethod)
149155
target_include_directories(boost_openmethod INTERFACE "${PROJECT_SOURCE_DIR}/include")
150156
boost_openmethod_setup_properties(boost_openmethod)

0 commit comments

Comments
 (0)