From f5f452bcb9571ac6ed30ee1775a104da09afc0bc Mon Sep 17 00:00:00 2001 From: Jordan Schidlowsky Date: Thu, 20 Sep 2018 00:12:40 -0600 Subject: [PATCH] cmake fails when project is used in other cmake projects. CMAKE_CURRENT_LIST_DIR should be a more portable path --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45e7633..32fdf33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,7 +205,7 @@ function(test_cxx CXX_RUNTIME_NAME IS_STDLIB) message(STATUS "Testing ${CXX_RUNTIME_LIB} as the C++ runtime library") try_compile(USERUNTIME "${CMAKE_BINARY_DIR}/CMake" - "${CMAKE_SOURCE_DIR}/CMake" + "${CMAKE_CURRENT_LIST_DIR}/CMake" test_cxx_runtime CMAKE_FLAGS "-DCXX_RUNTIME=${CXX_RUNTIME_LIB}") if (USERUNTIME) @@ -276,7 +276,7 @@ if (ENABLE_OBJCXX) message(STATUS "Testing C++ standard library") try_compile(USERUNTIME "${CMAKE_BINARY_DIR}/CMake" - "${CMAKE_SOURCE_DIR}/CMake" + "${CMAKE_CURRENT_LIST_DIR}/CMake" test_cxx_runtime) if (${USERUNTIME}) message(STATUS "libobjc will depend on C++ standard library")