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.
This commit is contained in:
Mateusz Loskot
2014-01-18 21:21:20 +00:00
parent bd73ba7ead
commit aad31d13cc
2 changed files with 5 additions and 2 deletions

View File

@@ -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)

View File

@@ -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 ()