Skip to content

Commit 215a8bf

Browse files
authored
CMake adjustments (apple#69)
* build: update cmake for TestHelpers rename * build: make CMake build on macOS work Unfortunately, XCTest importing is not working for some reason currently. However, this allows you to build on Darwin as follows: ``` cmake -G Ninja -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=NO -S . -B out ninja -C out ``` Windows and Linux builds remain functional. * build: refactor Examples build with CMake Although this goes contrary to best practices for CMake, this helps keep the source tree a bit leaner for the Examples.
1 parent be65f49 commit 215a8bf

File tree

9 files changed

+22
-23
lines changed

9 files changed

+22
-23
lines changed

Examples/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1-
add_subdirectory(math)
2-
add_subdirectory(repeat)
3-
add_subdirectory(roll)
1+
add_executable(math
2+
math/main.swift)
3+
target_link_libraries(math PRIVATE
4+
ArgumentParser)
5+
6+
add_executable(repeat
7+
repeat/main.swift)
8+
target_link_libraries(repeat PRIVATE
9+
ArgumentParser)
10+
11+
add_executable(roll
12+
roll/main.swift
13+
roll/SplitMix64.swift)
14+
target_link_libraries(roll PRIVATE
15+
ArgumentParser)

Examples/math/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

Examples/repeat/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

Examples/roll/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

Sources/ArgumentParser/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ set_target_properties(ArgumentParser PROPERTIES
3636
target_compile_options(ArgumentParser PRIVATE
3737
$<$<BOOL:${BUILD_TESTING}>:-enable-testing>)
3838
target_link_libraries(ArgumentParser PRIVATE
39-
Foundation)
39+
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)

Sources/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
add_subdirectory(ArgumentParser)
22
if(BUILD_TESTING)
3-
add_subdirectory(TestHelpers)
3+
add_subdirectory(SAPTestHelpers)
44
endif()

Sources/SAPTestHelpers/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
add_library(TestHelpers
1+
add_library(SAPTestHelpers
22
StringHelpers.swift
33
TestHelpers.swift)
4-
set_target_properties(TestHelpers PROPERTIES
4+
set_target_properties(SAPTestHelpers PROPERTIES
55
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
6-
target_link_libraries(TestHelpers PUBLIC
6+
target_link_libraries(SAPTestHelpers PUBLIC
77
ArgumentParser
88
XCTest)

Tests/EndToEndTests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ add_library(EndToEndTests
1616
SubcommandEndToEndTests.swift
1717
ValidationEndToEndTests.swift)
1818
target_link_libraries(EndToEndTests PUBLIC
19-
TestHelpers)
19+
SAPTestHelpers)

Tests/UnitTests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ add_library(UnitTests
88
UsageGenerationTests.swift)
99
target_link_libraries(UnitTests PRIVATE
1010
ArgumentParser
11-
TestHelpers)
11+
SAPTestHelpers)

0 commit comments

Comments
 (0)