In CMake, define the project-wide source directory for the test build.
* CMakeLists.txt
(SERF_SOURCE_DIR): New, used instead of CMAKE_CURRENT_SOURCE_DIR.
* test/CMakeLists.txt: Use SERF_SOURCE_DIR instead of CMAKE_SOURCE_DIR.
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1835101 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 632f69e..3062009 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,8 @@
cmake_minimum_required(VERSION 3.0.2)
-list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/build")
+set(SERF_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(CMAKE_MODULE_PATH "${SERF_SOURCE_DIR}/build")
include(SerfVersion)
project("Serf" VERSION ${SERF_VERSION} LANGUAGES C)
@@ -135,7 +136,7 @@
-DSERF_DEF_HEADERS="${HEADERS}"
-DSERF_DEF_FILE="${SERF_DEF_FILE}"
-P "build/SerfWindowsGenDef.cmake"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ WORKING_DIRECTORY "${SERF_SOURCE_DIR}"
)
set(SHARED_SOURCES "serf.rc" "${SERF_DEF_FILE}")
@@ -220,7 +221,7 @@
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${APR_CFLAGS}")
include_directories(BEFORE SYSTEM ${DEPENDENCY_INCLUDES})
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${SERF_SOURCE_DIR})
# Feature tests
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c3549ee..23fe72c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -70,4 +70,4 @@
add_test(NAME test_all COMMAND test_all)
set_tests_properties(${RESPONSE_TESTS} test_all PROPERTIES
- ENVIRONMENT srcdir=${CMAKE_SOURCE_DIR})
+ ENVIRONMENT srcdir=${SERF_SOURCE_DIR})