From 43c3aa75f1f69adad7640deaa418a47c63db48fd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 24 Aug 2015 15:59:49 +0200 Subject: [PATCH] Simplifying googletest building --- src/tests/CMakeLists.txt | 41 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index b9d776c94..f9e793be2 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -26,7 +26,7 @@ endif(GTEST_DIR) if(NOT GTEST_DIR_LOCAL) set(GTEST_DIR_LOCAL false) else() - set(GTEST_DIR_LOCAL true) + set(GTEST_DIR_LOCAL true) endif(NOT GTEST_DIR_LOCAL) if(GTEST_INCLUDE_DIRS) @@ -36,32 +36,17 @@ endif(GTEST_INCLUDE_DIRS) if(NOT ${GTEST_DIR_LOCAL}) # if GTEST_DIR is not defined, we download and build it set(gtest_RELEASE 1.7.0) - if(OS_IS_MACOSX) - ExternalProject_Add( - gtest-${gtest_RELEASE} - GIT_REPOSITORY https://github.com/google/googletest - GIT_TAG release-${gtest_RELEASE} - DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../download/gtest-${gtest_RELEASE} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${gtest_RELEASE} - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${gtest_RELEASE} - CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" - ) - else(OS_IS_MACOSX) - ExternalProject_Add( - gtest-${gtest_RELEASE} - GIT_REPOSITORY https://github.com/google/googletest - GIT_TAG release-${gtest_RELEASE} - DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../download/gtest-${gtest_RELEASE} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${gtest_RELEASE} - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${gtest_RELEASE} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" - ) - endif(OS_IS_MACOSX) + ExternalProject_Add( + gtest-${gtest_RELEASE} + GIT_REPOSITORY https://github.com/google/googletest + GIT_TAG release-${gtest_RELEASE} + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${gtest_RELEASE} + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${gtest_RELEASE} + CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" + ) # Set up variables # Set recently downloaded and build Googletest root folder set(GTEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${gtest_RELEASE}") @@ -82,7 +67,7 @@ if(NOT ${GTEST_DIR_LOCAL}) ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main.a ) - set(GTEST_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${gtest_RELEASE}") + set(GTEST_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${gtest_RELEASE}") else(NOT ${GTEST_DIR_LOCAL}) if(GTEST_INCLUDE_DIRS) set(GTEST_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIRS} ${LIBGTEST_DEV_DIR})