Skip to content

Commit 916bf4b

Browse files
committed
build: simplify the build rules (NFC)
The minimum version of CMake is set to 3.19.6. Remove the workarounds for the older releases of CMake allowing us to simplify the build rules.
1 parent e0604b6 commit 916bf4b

File tree

1 file changed

+7
-32
lines changed

1 file changed

+7
-32
lines changed

CMakeLists.txt

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,19 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
1212

1313
project(SwiftDriver LANGUAGES C Swift)
1414

15-
set(SWIFT_VERSION 5)
16-
set(CMAKE_Swift_LANGUAGE_VERSION ${SWIFT_VERSION})
17-
if(CMAKE_VERSION VERSION_LESS 3.16)
18-
add_compile_options($<$<COMPILE_LANGUAGE:Swift>:-swift-version$<SEMICOLON>${SWIFT_VERSION}>)
19-
set(CMAKE_LINK_LIBRARY_FLAG "-l")
20-
endif()
21-
22-
# ensure Swift compiler can find _CSwiftScan
23-
add_compile_options($<$<COMPILE_LANGUAGE:Swift>:-I$<SEMICOLON>${CMAKE_CURRENT_SOURCE_DIR}/Sources/CSwiftScan/include>)
24-
15+
set(CMAKE_Swift_LANGUAGE_VERSION 5)
2516
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
2617

27-
if(CMAKE_VERSION VERSION_LESS 3.16 AND CMAKE_SYSTEM_NAME STREQUAL Windows)
28-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
29-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
30-
else()
31-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
32-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
33-
endif()
18+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
19+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
3420
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
3521

36-
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
37-
3822
set(CMAKE_MACOSX_RPATH YES)
39-
if(CMAKE_VERSION VERSION_LESS 3.17)
40-
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
41-
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
42-
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
4323

44-
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
45-
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP "")
46-
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP "")
47-
else()
48-
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP ":")
49-
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":")
50-
endif()
51-
endif()
52-
endif()
24+
# ensure Swift compiler can find _CSwiftScan
25+
add_compile_options($<$<COMPILE_LANGUAGE:Swift>:-I$<SEMICOLON>${CMAKE_CURRENT_SOURCE_DIR}/Sources/CSwiftScan/include>)
26+
27+
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
5328

5429
find_package(TSC CONFIG REQUIRED)
5530

0 commit comments

Comments
 (0)