@@ -316,6 +316,10 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
316
316
target_compile_definitions (CoreFoundation
317
317
PRIVATE
318
318
-DDEPLOYMENT_TARGET_MACOSX )
319
+ elseif (CMAKE_SYSTEM_NAME STREQUAL Windows )
320
+ target_compile_definitions (CoreFoundation
321
+ PRIVATE
322
+ -DDEPLOYMENT_TARGET_WINDOWS )
319
323
endif ()
320
324
target_compile_definitions (CoreFoundation
321
325
PRIVATE
@@ -341,18 +345,11 @@ target_compile_definitions(CoreFoundation
341
345
$< $< COMPILE_LANGUAGE:ASM> :CF_CHARACTERSET_UNICHAR_DB="CharacterSets/CFUniCharPropertyDatabase.data">
342
346
$< $< COMPILE_LANGUAGE:ASM> :CF_CHARACTERSET_UNICODE_DATA_B="CharacterSets/CFUnicodeData-B.mapping">
343
347
$< $< COMPILE_LANGUAGE:ASM> :CF_CHARACTERSET_UNICODE_DATA_L="CharacterSets/CFUnicodeData-L.mapping"> )
344
- if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD )
345
- # FIXME(compnerd) why is /usr/local/include added manually? clang will do so
346
- target_include_directories (CoreFoundation
347
- PRIVATE
348
- "/usr/local/include"
349
- "/usr/local/include/libxml2"
350
- "/usr/local/include/curl" )
351
- endif ()
348
+
352
349
target_include_directories (CoreFoundation
353
350
PRIVATE
354
351
${CMAKE_SOURCE_DIR} )
355
- if (CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android )
352
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
356
353
find_package (LibXml2 REQUIRED )
357
354
target_include_directories (CoreFoundation
358
355
PRIVATE
@@ -365,23 +362,43 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android)
365
362
target_include_directories (CoreFoundation
366
363
PRIVATE
367
364
${ICU_INCLUDE_DIR} )
368
- else ()
365
+ endif ()
366
+ if (CF_ENABLE_LIBDISPATCH )
369
367
target_include_directories (CoreFoundation
370
368
PRIVATE
371
- "/usr/include"
372
- "/usr/include/libxml2" )
369
+ ${CF_PATH_TO_LIBDISPATCH_SOURCE}
370
+ ${CF_PATH_TO_LIBDISPATCH_BUILD} /tests )
371
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
372
+ target_include_directories (CoreFoundation
373
+ SYSTEM PRIVATE
374
+ ${CF_PATH_TO_LIBDISPATCH_SOURCE} /src/BlocksRuntime )
375
+ endif ()
373
376
endif ()
374
377
375
- target_compile_options (CoreFoundation
376
- PRIVATE
377
- $< $< COMPILE_LANGUAGE:C> :-include;${CMAKE_SOURCE_DIR} /Base.subproj/CoreFoundation_Prefix.h> )
378
- target_compile_options (CoreFoundation
379
- PRIVATE
380
- -fblocks
381
- -fconstant-cfstrings
382
- -fdollars-in-identifiers
383
- -fexceptions
384
- -fno-common )
378
+ if ("${CMAKE_SIMULATE_ID} " STREQUAL "MSVC" )
379
+ target_compile_options (CoreFoundation
380
+ PRIVATE
381
+ $< $< COMPILE_LANGUAGE:C> :/FI${CMAKE_SOURCE_DIR} /Base.subproj/CoreFoundation_Prefix.h> )
382
+ else ()
383
+ target_compile_options (CoreFoundation
384
+ PRIVATE
385
+ $< $< COMPILE_LANGUAGE:C> :-include;${CMAKE_SOURCE_DIR} /Base.subproj/CoreFoundation_Prefix.h> )
386
+ endif ()
387
+
388
+ if ("${CMAKE_SIMULATE_ID} " STREQUAL "MSVC" )
389
+ target_compile_options (CoreFoundation
390
+ PRIVATE
391
+ -fblocks
392
+ /EHsc )
393
+ else ()
394
+ target_compile_options (CoreFoundation
395
+ PRIVATE
396
+ -fblocks
397
+ -fconstant-cfstrings
398
+ -fdollars-in-identifiers
399
+ -fexceptions
400
+ -fno-common )
401
+ endif ()
385
402
if (CF_DEPLOYMENT_SWIFT )
386
403
target_compile_options (CoreFoundation
387
404
PRIVATE
@@ -396,17 +413,14 @@ target_compile_options(CoreFoundation
396
413
-Wno-conditional-uninitialized
397
414
-Wno-unused-variable
398
415
-Wno-int-conversion
399
- -Wno-unused-function )
400
- if (CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android )
416
+ -Wno-unused-function
417
+ -Wno-microsoft-enum-forward-reference )
418
+
419
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
401
420
target_link_libraries (CoreFoundation
402
421
PRIVATE
403
422
${CURL_LIBRARIES}
404
423
${LIBXML2_LIBRARIES} )
405
- else ()
406
- target_link_libraries (CoreFoundation
407
- PRIVATE
408
- curl
409
- xml2 )
410
424
endif ()
411
425
if (CMAKE_SYSTEM_NAME STREQUAL Android )
412
426
target_link_libraries (CoreFoundation
@@ -417,7 +431,7 @@ target_link_libraries(CoreFoundation
417
431
PRIVATE
418
432
Threads::Threads
419
433
${CMAKE_DL_LIBS} )
420
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows )
434
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin )
421
435
target_link_libraries (CoreFoundation
422
436
PRIVATE
423
437
m )
@@ -427,11 +441,7 @@ if(CF_ENABLE_LIBDISPATCH)
427
441
PRIVATE
428
442
dispatch )
429
443
endif ()
430
- if (CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android )
431
- set_target_properties (CoreFoundation
432
- PROPERTIES LINK_FLAGS
433
- -Xlinker;@${CMAKE_SOURCE_DIR}/linux.ld;-Bsymbolic )
434
- elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin )
444
+ if (CMAKE_SYSTEM_NAME STREQUAL Darwin )
435
445
target_link_libraries (CoreFoundation
436
446
PRIVATE
437
447
icucore )
@@ -451,17 +461,3 @@ install(DIRECTORY
451
461
USE_SOURCE_PERMISSIONS
452
462
PATTERN PrivateHeaders EXCLUDE )
453
463
454
-
455
- # TODO(compnerd) formalize this
456
- if (CF_ENABLE_LIBDISPATCH )
457
- target_include_directories (CoreFoundation
458
- PRIVATE
459
- ${CF_PATH_TO_LIBDISPATCH_SOURCE}
460
- ${CF_PATH_TO_LIBDISPATCH_BUILD} /tests )
461
- if (CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android )
462
- target_include_directories (CoreFoundation
463
- SYSTEM PRIVATE
464
- ${CF_PATH_TO_LIBDISPATCH_SOURCE} /src/BlocksRuntime )
465
- endif ()
466
- endif ()
467
-
0 commit comments