File tree 5 files changed +31
-7
lines changed
5 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,21 @@ if(NOT SwiftFoundation_MODULE_TRIPLE)
92
92
mark_as_advanced (SwiftFoundation_MODULE_TRIPLE)
93
93
endif ()
94
94
95
- # System dependencies (fail fast if dependencies are missing)
95
+ # System dependencies
96
+ find_package (dispatch CONFIG)
97
+ if (NOT dispatch_FOUND)
98
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" )
99
+ set (DISPATCH_INCLUDE_PATH "/usr/lib/swift" CACHE STRING "A path to where you can find libdispatch headers" )
100
+ message ("-- dispatch_DIR not found, using dispatch from SDK at ${DISPATCH_INCLUDE_PATH} " )
101
+ list (APPEND _Foundation_common_build_flags
102
+ "-I${DISPATCH_INCLUDE_PATH} "
103
+ "-I${DISPATCH_INCLUDE_PATH} /Block" )
104
+ else ()
105
+ message (FATAL_ERROR "-- dispatch_DIR is required on this platform" )
106
+ endif ()
107
+ endif ()
96
108
find_package (LibXml2 REQUIRED)
97
109
find_package (CURL REQUIRED)
98
- find_package (dispatch CONFIG REQUIRED)
99
110
100
111
# Common build flags (_CFURLSessionInterface, _CFXMLInterface, CoreFoundation)
101
112
list (APPEND _Foundation_common_build_flags
@@ -148,8 +159,7 @@ list(APPEND _Foundation_swift_build_flags
148
159
149
160
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" )
150
161
list (APPEND _Foundation_common_build_flags
151
- "-D_GNU_SOURCE"
152
- "-I/usr/lib/swift" ) # dispatch
162
+ "-D_GNU_SOURCE" )
153
163
endif ()
154
164
155
165
include (GNUInstallDirs)
Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ target_include_directories(CoreFoundation
105
105
PRIVATE
106
106
internalInclude)
107
107
108
+ target_compile_options (CoreFoundation INTERFACE
109
+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /include/module.modulemap>" )
110
+
108
111
target_compile_options (CoreFoundation PRIVATE
109
112
"SHELL:$<$<COMPILE_LANGUAGE:C>:${_Foundation_common_build_flags} >" )
110
113
Original file line number Diff line number Diff line change @@ -166,11 +166,14 @@ endif()
166
166
167
167
set_target_properties (Foundation PROPERTIES
168
168
INSTALL_RPATH "$ORIGIN"
169
- BUILD_RPATH "$<TARGET_FILE_DIR:swiftDispatch>"
170
169
INSTALL_REMOVE_ENVIRONMENT_RPATH ON )
171
170
172
- target_link_libraries (Foundation PUBLIC
173
- swiftDispatch)
171
+ if (dispatch_FOUND)
172
+ set_target_properties (Foundation PROPERTIES
173
+ BUILD_RPATH "$<TARGET_FILE_DIR:swiftDispatch>" )
174
+ target_link_libraries (Foundation PUBLIC
175
+ swiftDispatch)
176
+ endif ()
174
177
175
178
if (LINKER_SUPPORTS_BUILD_ID)
176
179
target_link_options (Foundation PRIVATE "LINKER:--build-id=sha1" )
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ target_include_directories(_CFURLSessionInterface
23
23
24
24
target_precompile_headers(_CFURLSessionInterface PRIVATE ${CMAKE_SOURCE_DIR} /Sources /CoreFoundation/internalInclude/CoreFoundation_Prefix.h)
25
25
26
+ target_compile_options (_CFURLSessionInterface INTERFACE
27
+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /../CoreFoundation/include/module.modulemap>"
28
+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /include/module.modulemap>" )
29
+
26
30
target_compile_options (_CFURLSessionInterface PRIVATE
27
31
"SHELL:$<$<COMPILE_LANGUAGE:C>:${_Foundation_common_build_flags} >" )
28
32
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ target_include_directories(_CFXMLInterface
22
22
../CoreFoundation/internalInclude
23
23
/usr/include /libxml2/)
24
24
25
+ target_compile_options (_CFXMLInterface INTERFACE
26
+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /../CoreFoundation/include/module.modulemap>"
27
+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /include/module.modulemap>" )
28
+
25
29
target_compile_options (_CFXMLInterface PRIVATE
26
30
"SHELL:$<$<COMPILE_LANGUAGE:C>:${_Foundation_common_build_flags} >" )
27
31
You can’t perform that action at this time.
0 commit comments