diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f2828d49..3714e8c87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,8 @@ if(POLICY CMP0157) endif() endif() +set(SWT_SOURCE_ROOT_DIR ${CMAKE_SOURCE_DIR}) + project(SwiftTesting LANGUAGES CXX Swift) diff --git a/Sources/TestingMacros/CMakeLists.txt b/Sources/TestingMacros/CMakeLists.txt index 9de696920..458bd4170 100644 --- a/Sources/TestingMacros/CMakeLists.txt +++ b/Sources/TestingMacros/CMakeLists.txt @@ -12,6 +12,8 @@ if(POLICY CMP0157) cmake_policy(SET CMP0157 NEW) endif() +set(SWT_SOURCE_ROOT_DIR ${CMAKE_SOURCE_DIR}/../..) + project(TestingMacros LANGUAGES Swift) diff --git a/cmake/modules/shared/CompilerSettings.cmake b/cmake/modules/shared/CompilerSettings.cmake index df3bb826a..e5a4fcbf6 100644 --- a/cmake/modules/shared/CompilerSettings.cmake +++ b/cmake/modules/shared/CompilerSettings.cmake @@ -43,7 +43,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WASI") add_compile_definitions("SWT_NO_PIPES") endif() -file(STRINGS "../VERSION.txt" SWT_TESTING_LIBRARY_VERSION LIMIT_COUNT 1) +file(STRINGS "${SWT_SOURCE_ROOT_DIR}/VERSION.txt" SWT_TESTING_LIBRARY_VERSION LIMIT_COUNT 1) if(SWT_TESTING_LIBRARY_VERSION) message(STATUS "Swift Testing version: ${SWT_TESTING_LIBRARY_VERSION}") add_compile_definitions("$<$:SWT_TESTING_LIBRARY_VERSION=\"${SWT_TESTING_LIBRARY_VERSION}\">")