Skip to content

Updated Cmakelists.txt #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This copies the enet.h file to wherever ${CMAKE_CURRENT_BINARY_DIR}/include points to, but it does it during the configuration step, not when installing.


if (MINGW)
target_link_libraries(enet winmm ws2_32)
endif()
Expand Down