From c910d1db8cc4aece60736e917586909dc50ab0fa Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 25 Jan 2022 17:18:11 +0100 Subject: [PATCH] [CMake] Add IDE target for the turtle headers Allows easier development in e.g. Visual Studio --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 957f3d7..5ddc100 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,8 @@ endif() find_package(Boost 1.58 REQUIRED) set(MOCK_VERSION "\"${PROJECT_VERSION}\"") -configure_file(version.hpp.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/turtle/version.hpp @ONLY) +set(_turtleVersionFile ${CMAKE_CURRENT_BINARY_DIR}/include/turtle/version.hpp) +configure_file(version.hpp.cmake ${_turtleVersionFile} @ONLY) add_library(turtle INTERFACE) add_library(turtle::turtle ALIAS turtle) @@ -30,6 +31,14 @@ target_compile_features(turtle INTERFACE cxx_std_14) target_link_libraries(turtle INTERFACE Boost::boost Boost::disable_autolinking) +if(NOT CMAKE_VERSION VERSION_LESS 3.19) + file(GLOB _turtleHeaders include/turtle/*.hpp) + file(GLOB _turtleHeadersDetail include/turtle/detail/*.hpp) + source_group(turtle FILES ${_turtleHeaders} ${_turtleVersionFile}) + source_group(turtle/detail FILES ${_turtleHeadersDetail}) + target_sources(turtle PRIVATE ${_turtleHeaders} ${_turtleVersionFile} ${_turtleHeadersDetail}) +endif() + if(BUILD_TESTING) add_subdirectory(test) endif()