From aad31d13ccd3cff418cfc13a6f0206c16fa078c5 Mon Sep 17 00:00:00 2001 From: Mateusz Loskot Date: Sat, 18 Jan 2014 21:21:20 +0000 Subject: [PATCH] Add headers to sources to enable file browsing in IDEs By adding headers to sources of targets, CMake adds them to list of project files generated for IDEs. This is non-intrusive trick, which does not affect targets compilation. --- CMakeLists.txt | 4 +++- tests/CMakeLists.txt | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b4058f0..5af682b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,9 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") endif () -include_directories("${PROJECT_SOURCE_DIR}/include") +set(include_dir "${PROJECT_SOURCE_DIR}/include") +file(GLOB_RECURSE sqlpp_headers ${include_dir}/*.h) +include_directories(${include_dir}) add_subdirectory(tests) install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/sqlpp11" DESTINATION include) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index abc1625f..54927e83 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,6 @@ macro (build_and_run arg) - add_executable(${arg} ${arg}.cpp) + # Add headers to sources to enable file browsing in IDEs + add_executable(${arg} ${arg}.cpp ${sqlpp_headers}) add_test(${arg} ${arg}) endmacro ()