From 529f60e2906e44ecc7aea24534d5d91624bbe4ce Mon Sep 17 00:00:00 2001 From: Ty N <1196438+ty-n-42@users.noreply.github.com> Date: Tue, 25 Oct 2022 15:24:42 +1100 Subject: [PATCH] Updated Cmakelists.txt Slightly modified the cake configuration to make it easier to use the library in downstream code: should be able to #include "enet/enet.h" without any special IDE configuration. --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6459b62..74554baf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,8 +55,6 @@ if(HAS_SOCKLEN_T) add_definitions(-DHAS_SOCKLEN_T=1) endif() -include_directories(${PROJECT_SOURCE_DIR}/include) - set(INCLUDE_FILES_PREFIX include/enet) set(INCLUDE_FILES ${INCLUDE_FILES_PREFIX}/callbacks.h @@ -89,6 +87,11 @@ add_library(enet STATIC ${SOURCE_FILES} ) +target_include_directories(enet PUBLIC ${PROJECT_SOURCE_DIR}/include) # define the public header files path +# consuming projects should be able to do #include "enet/enet.h" in their IDE (tested with CLion) + +file(COPY ${INCLUDE_FILES_PREFIX}/enet.h DESTINATION "include") # Copy the public header file to the build include directory for convenience + if (MINGW) target_link_libraries(enet winmm ws2_32) endif()