From d6bb25e1e0a25cb5aa781ac4f90b513fd5624f50 Mon Sep 17 00:00:00 2001 From: Gregor Burger Date: Tue, 20 Nov 2018 11:48:03 +0100 Subject: move all public headers to include/nng/ folder This change makes embedding nng + nggpp (or other projects depending on nng) in cmake easier. The header files are moved to a separate include directory. This also makes installation of the headers easier, and allows clearer identification of private vs public heade files. Some additional cleanups were performed by @gedamore, but the main credit for this change belongs with @gregorburger. --- src/CMakeLists.txt | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 960e912c..dff34f9f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,10 +24,9 @@ # IN THE SOFTWARE. # -set (NNG_HDRS nng.h) set (NNG_SRCS nng.c - nng.h + ${PROJECT_SOURCE_DIR}/include/nng/nng.h core/defs.h @@ -246,7 +245,10 @@ set_target_properties (${PROJECT_NAME} ${PROJECT_NAME} target_link_libraries (${PROJECT_NAME} PRIVATE ${NNG_LIBS}) -target_include_directories (${PROJECT_NAME} INTERFACE $ $) +target_include_directories (${PROJECT_NAME} INTERFACE $ +$) + +target_include_directories (${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/include) install (TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-target @@ -263,14 +265,10 @@ install (EXPORT ${PROJECT_NAME}-target COMPONENT Library ) -# Install the header files. It would be much better if we could use -# the PUBLIC_HEADER facility, but it stupidly flattens the directories. -foreach (f ${NNG_HDRS}) - get_filename_component(d ${f} DIRECTORY) - install(FILES ${f} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nng/${d} - COMPONENT Headers) -endforeach() +# Install the header files. +install(DIRECTORY ../include/nng + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT Headers) # Promote settings to parent set(NNG_LIBS ${NNG_LIBS} PARENT_SCOPE) @@ -296,7 +294,7 @@ write_basic_package_version_file("${version_config}" VERSION ${NNG_PACKAGE_VERSION} COMPATIBILITY SameMajorVersion ) -configure_package_config_file(${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in "${project_config}" +configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in "${project_config}" INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" PATH_VARS INCLUDE_INSTALL_DIRS) -- cgit v1.2.3-70-g09d2