Skip to content

Commit ee7544a

Browse files
committed
Set CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
1 parent 3da1534 commit ee7544a

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required (VERSION 3.10)
2-
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
2+
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
33
set (HAVE_CMAKE true)
44
# https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html
55
set(CMAKE_CXX_STANDARD 17)
@@ -30,11 +30,11 @@ if (PROJECT_IS_TOP_LEVEL)
3030

3131
message ("-- Configuring cmake.h")
3232
configure_file (
33-
${CMAKE_SOURCE_DIR}/cmake.h.in
34-
${CMAKE_SOURCE_DIR}/cmake.h)
33+
${CMAKE_CURRENT_SOURCE_DIR}/cmake.h.in
34+
${CMAKE_CURRENT_SOURCE_DIR}/cmake.h)
3535
endif (PROJECT_IS_TOP_LEVEL)
3636

3737
add_subdirectory (src)
38-
if (EXISTS ${CMAKE_SOURCE_DIR}/test)
38+
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test)
3939
add_subdirectory (test EXCLUDE_FROM_ALL)
40-
endif (EXISTS ${CMAKE_SOURCE_DIR}/test)
40+
endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test)

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required (VERSION 3.10)
2-
include_directories (${CMAKE_SOURCE_DIR}
3-
${CMAKE_SOURCE_DIR}/src)
2+
include_directories (${CMAKE_CURRENT_SOURCE_DIR}
3+
${CMAKE_CURRENT_SOURCE_DIR}/..)
44

55
set (shared_HEADERS Args.h
66
Color.h

test/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ if(POLICY CMP0037 AND ${CMAKE_VERSION} VERSION_LESS "3.11.0")
88
cmake_policy(SET CMP0037 OLD)
99
endif()
1010

11-
include_directories (${CMAKE_SOURCE_DIR}
12-
${CMAKE_SOURCE_DIR}/src
13-
${CMAKE_SOURCE_DIR}/test
11+
include_directories (${CMAKE_CURRENT_SOURCE_DIR}
12+
${CMAKE_CURRENT_SOURCE_DIR}/../src
13+
${CMAKE_CURRENT_SOURCE_DIR}/..
1414
${SHARED_INCLUDE_DIRS})
1515

1616
set (test_SRCS args.t autocomplete.t charliteral.t composite.t color.t configuration.t dates.t datetime.t duration.t external.t format.t fs.t intrinsic.t json.t json_test lexer.t list.t msg.t negative.t palette.t peg.t pig.t plus.t positive.t question.t rx.t sax_test shared.t star.t stringliteral.t table.t timer.t tree.t unicode.t utf8.t)
@@ -27,3 +27,6 @@ endforeach (src_FILE)
2727
configure_file(run_all run_all COPYONLY)
2828
configure_file(problems problems COPYONLY)
2929

30+
# Copy config directory structure to build directory for tests
31+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/config DESTINATION ${CMAKE_BINARY_DIR}/test)
32+

0 commit comments

Comments
 (0)