Browse Source

CMake Config and Version exports (#22)

pull/29/head
JosiahWI 1 year ago
committed by GitHub
parent
commit
9840eeabe8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      CMakeLists.txt
  2. 5
      Config.cmake.in
  3. 10
      source/Irrlicht/CMakeLists.txt

48
CMakeLists.txt

@ -1,13 +1,11 @@
cmake_minimum_required(VERSION 3.5)
project(Irrlicht CXX)
project(Irrlicht
VERSION 1.9.0
LANGUAGES CXX
)
set(IRRLICHT_VERSION_MAJOR 1)
set(IRRLICHT_VERSION_MINOR 9)
set(IRRLICHT_VERSION_RELEASE 0)
set(VERSION "${IRRLICHT_VERSION_MAJOR}.${IRRLICHT_VERSION_MINOR}.${IRRLICHT_VERSION_RELEASE}")
message(STATUS "*** Building IrrlichtMt ${VERSION} ***")
message(STATUS "*** Building IrrlichtMt ${PROJECT_VERSION} ***")
if(ANDROID)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/Android)
@ -28,3 +26,39 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
add_subdirectory(source/Irrlicht)
# Installation of library and headers.
include(GNUInstallDirs)
install(TARGETS IrrlichtMt
EXPORT IrrlichtMt-export
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/IrrlichtMt"
)
# Installation of CMake target and configuration files.
install(EXPORT IrrlichtMt-export
FILE IrrlichtMtTargets.cmake
NAMESPACE IrrlichtMt::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
)
include(CMakePackageConfigHelpers)
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
)

5
Config.cmake.in

@ -0,0 +1,5 @@
@PACKAGE_INIT@
if(NOT TARGET IrrlichtMt::IrrlichtMt)
include("${CMAKE_CURRENT_LIST_DIR}/IrrlichtMtTargets.cmake")
endif()

10
source/Irrlicht/CMakeLists.txt

@ -394,16 +394,10 @@ add_library(IrrlichtMt
)
set_target_properties(IrrlichtMt PROPERTIES
VERSION ${VERSION}
SOVERSION ${IRRLICHT_VERSION_MAJOR}.${IRRLICHT_VERSION_MINOR}
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
if(WIN32)
set_target_properties(IrrlichtMt PROPERTIES PREFIX "") # for DLL name
endif()
# Installation
include(GNUInstallDirs)
install(TARGETS IrrlichtMt DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrlichtmt")

Loading…
Cancel
Save