From b4c7743699951b48b217b3019e273b9f4677b870 Mon Sep 17 00:00:00 2001 From: Mayeul d'Avezac Date: Wed, 27 Apr 2016 09:57:19 +0100 Subject: [PATCH] Doesn't add libgtest.a until it exists Closes #45 --- scripts/AddGTest.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/AddGTest.cmake b/scripts/AddGTest.cmake index 4b5e36f..a8f7c52 100644 --- a/scripts/AddGTest.cmake +++ b/scripts/AddGTest.cmake @@ -19,11 +19,13 @@ macro(add_gtest name source) # "${source_dir}/include;${THISTEST_INCLUDE}") add_executable(test_${name} ${source}) - if(MSVC) + if(EXISTS ${EXTERNAL_ROOT}/lib/gtest.lib) target_link_libraries(test_${name} ${EXTERNAL_ROOT}/lib/gtest.lib) - else(MSVC) + elseif(EXISTS ${EXTERNAL_ROOT}/lib/libgtest.a) target_link_libraries(test_${name} ${EXTERNAL_ROOT}/lib/libgtest.a) - endif(MSVC) + elseif(NOT GTest_LOOKUP_BUILD) + message(FATAL_ERROR "Could not find gtest") + endif() if(CMAKE_THREAD_LIBS_INIT) target_link_libraries(test_${name} ${CMAKE_THREAD_LIBS_INIT}) endif(CMAKE_THREAD_LIBS_INIT)