Skip to content

Commit 9a1fc35

Browse files
authored
Fix the path to VERSION.txt used in CMake. (#1327)
Fixes a bug introduced in #1320. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 05b4639 commit 9a1fc35

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ if(POLICY CMP0157)
1919
endif()
2020
endif()
2121

22+
set(SWT_SOURCE_ROOT_DIR ${CMAKE_SOURCE_DIR})
23+
2224
project(SwiftTesting
2325
LANGUAGES CXX Swift)
2426

Sources/TestingMacros/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ if(POLICY CMP0157)
1212
cmake_policy(SET CMP0157 NEW)
1313
endif()
1414

15+
set(SWT_SOURCE_ROOT_DIR ${CMAKE_SOURCE_DIR}/../..)
16+
1517
project(TestingMacros
1618
LANGUAGES Swift)
1719

cmake/modules/shared/CompilerSettings.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
4343
add_compile_definitions("SWT_NO_PIPES")
4444
endif()
4545

46-
file(STRINGS "../VERSION.txt" SWT_TESTING_LIBRARY_VERSION LIMIT_COUNT 1)
46+
file(STRINGS "${SWT_SOURCE_ROOT_DIR}/VERSION.txt" SWT_TESTING_LIBRARY_VERSION LIMIT_COUNT 1)
4747
if(SWT_TESTING_LIBRARY_VERSION)
4848
message(STATUS "Swift Testing version: ${SWT_TESTING_LIBRARY_VERSION}")
4949
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:SWT_TESTING_LIBRARY_VERSION=\"${SWT_TESTING_LIBRARY_VERSION}\">")

0 commit comments

Comments
 (0)