include (CheckLibraryExists)
include (CheckCXXSourceCompiles)
include (CheckCXXCompilerFlag)
+include (GenerateExportHeader)
# using 10.7 because boost requires libc++ and 10.6 doesn't include it
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
add_subdirectory(3rdparty)
add_subdirectory(simgear)
+#-----------------------------------------------------------------------------
+### Export stuff, see https://cmake.org/cmake/help/v3.2/manual/cmake-packages.7.html#creating-packages
+#-----------------------------------------------------------------------------
+
+generate_export_header(SimGearCore)
+generate_export_header(SimGearScene)
+
+include(CMakePackageConfigHelpers)
+
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfigVersion.cmake"
+ VERSION ${SIMGEAR_VERSION}
+ COMPATIBILITY AnyNewerVersion
+)
+
+export(EXPORT SimGearTargets
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearTargets.cmake"
+ NAMESPACE Upstream::
+)
+
+configure_file(SimGearConfig.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfig.cmake"
+ @ONLY
+)
+
+set(ConfigPackageLocation lib/cmake/SimGear)
+install(EXPORT SimGearTargets
+ DESTINATION ${ConfigPackageLocation}
+)
+install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfigVersion.cmake"
+ DESTINATION ${ConfigPackageLocation}
+ COMPONENT Devel
+)
+
#-----------------------------------------------------------------------------
### uninstall target
#-----------------------------------------------------------------------------
--- /dev/null
+include(CMakeFindDependencyMacro)
+
+find_dependency(ZLIB)
+find_dependency(Threads)
+
+# OSG
+
+set(SIMGEAR_HEADLESS @SIMGEAR_HEADLESS@)
+set(SIMGEAR_SOUND @ENABLE_SOUND@)
+
+# OpenAL isn't a public dependency, so maybe not needed
+#if (SIMGEAR_SOUND)
+# find_dependency(OpenAL)
+#endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/SimGearTargets.cmake")
set_property(TARGET SimGearCore PROPERTY LINKER_LANGUAGE CXX)
set_property(TARGET SimGearCore PROPERTY VERSION ${SIMGEAR_VERSION})
set_property(TARGET SimGearCore PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
- install(TARGETS SimGearCore EXPORT SimGearCoreConfig LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install(EXPORT SimGearCoreConfig DESTINATION share/SimGearCore)
+ install(TARGETS SimGearCore
+ EXPORT SimGearTargets
+ LIBRARY DESTINATION
+ ${CMAKE_INSTALL_LIBDIR})
if(NOT SIMGEAR_HEADLESS)
add_library(SimGearScene SHARED ${sceneSources})
set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
# EXPORT SimGearSceneConfig
- install(TARGETS SimGearScene LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
- # install(EXPORT SimGearSceneConfig DESTINATION share/SimGearScene)
+ install(TARGETS SimGearScene
+ EXPORT SimGearTargets
+ LIBRARY
+ DESTINATION ${CMAKE_INSTALL_LIBDIR} )
endif()
else()
endforeach()
add_library(SimGearCore STATIC ${coreSources} ${localExpatSources})
- install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(TARGETS SimGearCore
+ EXPORT SimGearTargets
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT SIMGEAR_HEADLESS)
get_property(FG_GROUPS_SCENE_SOURCES_C GLOBAL PROPERTY FG_GROUPS_SCENE_SOURCES_C)
endforeach()
add_library(SimGearScene STATIC ${sceneSources})
- install(TARGETS SimGearScene ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(TARGETS SimGearScene
+ EXPORT SimGearTargets
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT SIMGEAR_HEADLESS)
endif(SIMGEAR_SHARED)