mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 01:06:00 +08:00
Add CMake Target Exporting & option to disable testing in the build (#2329)
* Fix cmake install * Option to build without testing * Add target exporting and SpineConfig.cmake * Revert relative install paths to Spine preferred ones
This commit is contained in:
parent
cd1935d1e0
commit
373a163c3f
@ -5,8 +5,9 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Install location" FORCE)
|
||||
endif()
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
set(SPINE_SFML FALSE CACHE BOOL FALSE)
|
||||
set(SPINE_SANITIZE FALSE CACHE BOOL FALSE)
|
||||
option(SPINE_SFML "Build spine SFML API" OFF)
|
||||
option(SPINE_SANITIZE "Build with sanitization" OFF)
|
||||
option(BUILD_TESTING "Build with testing" ON)
|
||||
|
||||
if(MSVC)
|
||||
message("MSCV detected")
|
||||
@ -42,5 +43,12 @@ elseif((${SPINE_SDL}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sdl"))
|
||||
else()
|
||||
add_subdirectory(spine-c)
|
||||
add_subdirectory(spine-cpp)
|
||||
if (${BUILD_TESTING})
|
||||
add_subdirectory(spine-cpp/spine-cpp-unit-tests)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Create config file that include the exported targets
|
||||
configure_file(SpineConfig.cmake.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/SpineConfig.cmake"
|
||||
@ONLY)
|
||||
1
SpineConfig.cmake.in
Normal file
1
SpineConfig.cmake.in
Normal file
@ -0,0 +1 @@
|
||||
include("@CMAKE_CURRENT_BINARY_DIR@/spine-cpp/spine-cppTargets.cmake")
|
||||
@ -13,5 +13,13 @@ file(GLOB SOURCES "spine-cpp/src/**/*.cpp")
|
||||
|
||||
add_library(spine-cpp STATIC ${SOURCES} ${INCLUDES})
|
||||
target_include_directories(spine-cpp PUBLIC spine-cpp/include)
|
||||
install(TARGETS spine-cpp DESTINATION dist/lib)
|
||||
|
||||
# Install target
|
||||
install(TARGETS spine-cpp EXPORT spine-cpp_TARGETS DESTINATION dist/lib)
|
||||
install(FILES ${INCLUDES} DESTINATION dist/include)
|
||||
|
||||
# Export target
|
||||
export(
|
||||
EXPORT spine-cpp_TARGETS
|
||||
FILE ${CMAKE_CURRENT_BINARY_DIR}/spine-cppTargets.cmake
|
||||
NAMESPACE "Spine::")
|
||||
Loading…
x
Reference in New Issue
Block a user