Commit 7562d021 authored by Milo Yip's avatar Milo Yip

Merge pull request #334 from Phyks/master

Fix CMakeLists for include as a thirdparty in projects
parents 7eb117a2 89ad34ce
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
PROJECT(RapidJSON CXX) PROJECT(RapidJSON CXX)
...@@ -17,7 +17,7 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ...@@ -17,7 +17,7 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON) option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON)
option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON) option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON)
option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON) option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON)
option(RAPIDJSON_BUILD_THIRDPARTY_GTEST option(RAPIDJSON_BUILD_THIRDPARTY_GTEST
"Use gtest installation in `thirdparty/gtest` by default if available" OFF) "Use gtest installation in `thirdparty/gtest` by default if available" OFF)
option(RAPIDJSON_HAS_STDSTRING "" OFF) option(RAPIDJSON_HAS_STDSTRING "" OFF)
...@@ -45,7 +45,7 @@ ELSEIF(WIN32) ...@@ -45,7 +45,7 @@ ELSEIF(WIN32)
ENDIF() ENDIF()
SET(CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" CACHE PATH "The directory cmake fiels are installed in") SET(CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" CACHE PATH "The directory cmake fiels are installed in")
include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
if(RAPIDJSON_BUILD_DOC) if(RAPIDJSON_BUILD_DOC)
add_subdirectory(doc) add_subdirectory(doc)
......
SET(GTEST_SEARCH_PATH SET(GTEST_SEARCH_PATH
"${GTEST_SOURCE_DIR}" "${GTEST_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/thirdparty/gtest") "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/gtest")
IF(UNIX) IF(UNIX)
IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST) IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST)
...@@ -15,6 +15,7 @@ FIND_PATH(GTEST_SOURCE_DIR ...@@ -15,6 +15,7 @@ FIND_PATH(GTEST_SOURCE_DIR
NAMES CMakeLists.txt src/gtest_main.cc NAMES CMakeLists.txt src/gtest_main.cc
PATHS ${GTEST_SEARCH_PATH}) PATHS ${GTEST_SEARCH_PATH})
# Debian installs gtest include directory in /usr/include, thus need to look # Debian installs gtest include directory in /usr/include, thus need to look
# for include directory separately from source directory. # for include directory separately from source directory.
FIND_PATH(GTEST_INCLUDE_DIR FIND_PATH(GTEST_INCLUDE_DIR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment