diff --git a/CMakeLists.txt b/CMakeLists.txt index 81bcf2d816..ecc6c3c9e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,8 @@ if(ENABLE_TESTING) add_subdirectory(TestFoundation) endif() +add_subdirectory(cmake/modules) + # TODO(compnerd) install as a Framework as that is how swift actually is built install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CoreFoundation.framework/Headers/ diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt index b683421560..2af14fc230 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt @@ -239,6 +239,8 @@ set_target_properties(FoundationXML PROPERTIES Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift) +set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS + Foundation FoundationNetworking FoundationXML) get_swift_host_arch(swift_arch) install(TARGETS Foundation FoundationNetworking FoundationXML ARCHIVE DESTINATION lib/swift$<$>:_static>/$ diff --git a/Tools/plutil/CMakeLists.txt b/Tools/plutil/CMakeLists.txt index 0e87391e80..bdfed9ffab 100644 --- a/Tools/plutil/CMakeLists.txt +++ b/Tools/plutil/CMakeLists.txt @@ -9,5 +9,6 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Dar "SHELL:-Xlinker -rpath -Xlinker $$$$ORIGIN/../lib/swift/$:$") endif() +set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS plutil) install(TARGETS plutil DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 0000000000..3dbaaace15 --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,7 @@ + +set(Foundation_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/FoundationExports.cmake) +configure_file(FoundationConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/FoundationConfig.cmake) + +get_property(Foundation_EXPORTS GLOBAL PROPERTY Foundation_EXPORTS) +export(TARGETS ${Foundation_EXPORTS} FILE ${Foundation_EXPORTS_FILE}) diff --git a/cmake/modules/FoundationConfig.cmake.in b/cmake/modules/FoundationConfig.cmake.in new file mode 100644 index 0000000000..77f0b76fbc --- /dev/null +++ b/cmake/modules/FoundationConfig.cmake.in @@ -0,0 +1,4 @@ + +if(NOT TARGET Foundation) + include(@Foundation_EXPORTS_FILE@) +endif() diff --git a/uuid/CMakeLists.txt b/uuid/CMakeLists.txt index ce6a480d35..f4103a14df 100644 --- a/uuid/CMakeLists.txt +++ b/uuid/CMakeLists.txt @@ -20,3 +20,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows) endif() set_target_properties(uuid PROPERTIES POSITION_INDEPENDENT_CODE YES) + +if(NOT BUILD_SHARED_LIBS) + set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS uuid) +endif()