From a74a80730da3dfa530bf0915c31cd53892d6e309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rait=20R=C3=A4=C3=A4k?= Date: Sat, 9 Mar 2019 02:27:59 +1100 Subject: [PATCH] List headers as sources --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f0951fc..922d951d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ option(SPDLOG_BUILD_BENCH "Build benchmarks (Requires https://github.com/google/ option(SPDLOG_BUILD_TESTS "Build tests" ${SPDLOG_MASTER_PROJECT}) option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF) option(SPDLOG_INSTALL "Generate the install target." ${SPDLOG_MASTER_PROJECT}) +option(SPDLOG_LIST_HEADERS_AS_SOURCES "List headers as source files for IDE use." OFF) if(SPDLOG_FMT_EXTERNAL AND NOT TARGET fmt::fmt) find_package(fmt REQUIRED CONFIG) @@ -73,6 +74,11 @@ endif() set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include") +if(SPDLOG_LIST_HEADERS_AS_SOURCES) + file(GLOB_RECURSE spdlog_include_SRCS "${HEADER_BASE}/*.h") + target_sources(spdlog INTERFACE ${spdlog_include_SRCS}) +endif() + if(SPDLOG_BUILD_EXAMPLES) add_subdirectory(example) endif() @@ -155,6 +161,3 @@ export( export(PACKAGE ${PROJECT_NAME}) endif() - -file(GLOB_RECURSE spdlog_include_SRCS "${HEADER_BASE}/*.h") -add_custom_target(spdlog_headers_for_ide SOURCES ${spdlog_include_SRCS})