Skip to content

Commit

Permalink
Merge pull request #184 from Hoikas/target-includes
Browse files Browse the repository at this point in the history
Cmake modernization for vcpkg port.
  • Loading branch information
zrax authored Aug 30, 2020
2 parents 80e2990 + 1d88c0d commit a08313a
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ endif()

if(MSVC)
add_definitions("-D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_CXX_FLAGS "/wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "/bigobj /wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "/wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_C_FLAGS}")
endif()

Expand Down
1 change: 0 additions & 1 deletion Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()

include_directories(${PROJECT_SOURCE_DIR}/core)
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(./)

Expand Down
2 changes: 0 additions & 2 deletions Tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include_directories(${PROJECT_SOURCE_DIR}/core)

try_compile(DIRENT_IS_CONST ${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/check_dirent.cpp
OUTPUT_VARIABLE OUTPUT)
Expand Down
13 changes: 12 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ if(PHYSX_FOUND AND ENABLE_PHYSX)
target_link_libraries(HSPlasma ${PHYSX_COOKING_LIBRARY})
endif(PHYSX_FOUND AND ENABLE_PHYSX)

target_include_directories(HSPlasma PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<INSTALL_INTERFACE:include/HSPlasma>)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libhsplasma.pc.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/libhsplasma.pc @ONLY)

# Package Installation
Expand All @@ -815,7 +819,14 @@ install(TARGETS HSPlasma
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES HSPlasmaConfig.cmake DESTINATION share/cmake/HSPlasma)

include(CMakePackageConfigHelpers)
configure_package_config_file(HSPlasmaConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasma)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaConfig.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasma)

install(FILES ${DEBUG_HEADERS} DESTINATION include/HSPlasma/Debug)
install(FILES ${MATH_HEADERS} DESTINATION include/HSPlasma/Math)
install(FILES ${PRP_ANIM_HEADERS} DESTINATION include/HSPlasma/PRP/Animation)
Expand Down
3 changes: 0 additions & 3 deletions core/HSPlasmaConfig.cmake

This file was deleted.

5 changes: 5 additions & 0 deletions core/HSPlasmaConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include(${CMAKE_CURRENT_LIST_DIR}/HSPlasma-targets.cmake)

@PACKAGE_INIT@

set_and_check(HSPlasma_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include/HSPlasma")
13 changes: 12 additions & 1 deletion net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ if(WIN32)
target_link_libraries(HSPlasmaNet ws2_32)
endif(WIN32)

target_include_directories(HSPlasmaNet PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<INSTALL_INTERFACE:include/HSPlasmaNet>)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libhsplasmanet.pc.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/libhsplasmanet.pc @ONLY)

# Package installation
Expand All @@ -113,7 +117,14 @@ install(TARGETS HSPlasmaNet
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES HSPlasmaNetConfig.cmake DESTINATION share/cmake/HSPlasmaNet)

include(CMakePackageConfigHelpers)
configure_package_config_file(HSPlasmaNetConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaNetConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasmaNet)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaNetConfig.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasmaNet)

install(FILES ${PN_AUTH_HEADERS} DESTINATION include/HSPlasmaNet/auth)
install(FILES ${PN_CRYPT_HEADERS} DESTINATION include/HSPlasmaNet/crypt)
install(FILES ${PN_FILE_HEADERS} DESTINATION include/HSPlasmaNet/file)
Expand Down
5 changes: 0 additions & 5 deletions net/HSPlasmaNetConfig.cmake

This file was deleted.

8 changes: 8 additions & 0 deletions net/HSPlasmaNetConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include(${CMAKE_CURRENT_LIST_DIR}/HSPlasmaNet-targets.cmake)

@PACKAGE_INIT@

find_package(HSPlasma)
set_and_check(HSPlasmaNet_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include/HSPlasmaNet")
set(HSPlasmaNet_INCLUDE_DIRS ${HSPlasmaNet_INCLUDE_DIR} ${HSPlasma_INCLUDE_DIRS})
set(HSPlasmaNet_LIBRARIES HSPlasmaNet HSPlasma)

0 comments on commit a08313a

Please sign in to comment.