Cmake refresh
Use target objects everywhere, and simplify handling of system vs local dependencies.
This commit is contained in:
Vendored
+1
-1
@@ -2,6 +2,6 @@ if (NOT SYSTEM_EXPAT)
|
||||
add_subdirectory(expat)
|
||||
endif()
|
||||
|
||||
if (ENABLE_DNS AND NOT SYSTEM_UDNS)
|
||||
if (NOT SYSTEM_UDNS)
|
||||
add_subdirectory(udns)
|
||||
endif()
|
||||
|
||||
Vendored
+21
-5
@@ -26,8 +26,24 @@ set(expat_sources
|
||||
sg_expat_external.h
|
||||
)
|
||||
|
||||
foreach(s ${expat_sources})
|
||||
set_property(GLOBAL
|
||||
APPEND PROPERTY LOCAL_EXPAT_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${s}")
|
||||
endforeach()
|
||||
add_library(FGExpat STATIC ${expat_sources})
|
||||
|
||||
target_include_directories(FGExpat BEFORE PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
|
||||
# for the config file above
|
||||
target_include_directories(FGExpat PRIVATE ${PROJECT_BINARY_DIR}/3rdparty/expat)
|
||||
|
||||
target_compile_definitions(FGExpat PUBLIC HAVE_SIMGEAR_EXPAT_CONFIG_H XML_STATIC)
|
||||
|
||||
# look like Expat found by find()
|
||||
add_library(EXPAT::EXPAT ALIAS FGExpat)
|
||||
|
||||
# in the non-shared case, we need to export these as well
|
||||
if (NOT SIMGEAR_SHARED)
|
||||
install(TARGETS FGExpat
|
||||
EXPORT SimGearTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
Vendored
+18
-2
@@ -13,7 +13,6 @@ CHECK_SYMBOL_EXISTS(AF_INET6 "netinet/in.h" HAVE_IPv6)
|
||||
check_include_file(windows.h WINDOWS)
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
|
||||
include_directories(${CMAKE_BINARY_DIR})
|
||||
|
||||
set(HEADERS
|
||||
)
|
||||
@@ -38,4 +37,21 @@ set(SOURCES
|
||||
udns_XtoX.c
|
||||
)
|
||||
|
||||
simgear_component(udns 3rdparty/udns "${SOURCES}" "${HEADERS}")
|
||||
add_library(FGUdns STATIC ${SOURCES})
|
||||
|
||||
target_include_directories(FGUdns BEFORE PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
|
||||
target_include_directories(FGUdns PRIVATE ${CMAKE_BINARY_DIR})
|
||||
|
||||
# match the name of imported UDns
|
||||
add_librarY(Udns::Udns ALIAS FGUdns)
|
||||
|
||||
# in the non-shared case, we need to export these as well
|
||||
if (NOT SIMGEAR_SHARED)
|
||||
install(TARGETS FGUdns
|
||||
EXPORT SimGearTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user