diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 118d5956c..bb6109c8b 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -41,11 +41,10 @@ if(NOT GOOGLETEST_FOUND) if(CMAKE_BUILD_TYPE MATCHES Debug) set(DEBUG_POSTFIX "d") endif() - if(OS_IS_MACOSX) - if(CMAKE_GENERATOR STREQUAL Xcode) - set(DEBUG_PREFIX "Debug/") - set(DEBUG_POSTFIX "d") - endif() + set(GTEST_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}") + if(CMAKE_GENERATOR STREQUAL Xcode) + set(XCODE_PREFIX "${CMAKE_BUILD_TYPE}/") + set(GTEST_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}" "-target" "gtest_main") endif() if(CMAKE_VERSION VERSION_LESS 3.2) @@ -55,6 +54,7 @@ if(NOT GOOGLETEST_FOUND) SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${GNSSSDR_GTEST_LOCAL_VERSION} CMAKE_ARGS ${GTEST_COMPILER} -DINSTALL_GTEST=OFF -DBUILD_GMOCK=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -Dgtest_hide_internal_symbols=ON ${TOOLCHAIN_ARG} + BUILD_COMMAND ${GTEST_BUILD_COMMAND} UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_COMMAND "" @@ -66,6 +66,7 @@ if(NOT GOOGLETEST_FOUND) SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${GNSSSDR_GTEST_LOCAL_VERSION} CMAKE_ARGS ${GTEST_COMPILER} -DINSTALL_GTEST=OFF -DBUILD_GMOCK=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -Dgtest_hide_internal_symbols=ON ${TOOLCHAIN_ARG} + BUILD_COMMAND ${GTEST_BUILD_COMMAND} UPDATE_COMMAND "" PATCH_COMMAND "" BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} @@ -81,9 +82,9 @@ if(NOT GOOGLETEST_FOUND) add_dependencies(GTest::GTest gtest-${GNSSSDR_GTEST_LOCAL_VERSION}) set_target_properties(GTest::GTest PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${binary_dir}/lib/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${binary_dir}/lib/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include" - INTERFACE_LINK_LIBRARIES "${binary_dir}/lib/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_LINK_LIBRARIES "${binary_dir}/lib/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" ) set_target_properties(GTest::GTest PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads @@ -94,9 +95,9 @@ if(NOT GOOGLETEST_FOUND) add_dependencies(GTest::Main gtest-${GNSSSDR_GTEST_LOCAL_VERSION}) set_target_properties(GTest::Main PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${binary_dir}/lib/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${binary_dir}/lib/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include" - INTERFACE_LINK_LIBRARIES "${binary_dir}/lib/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_LINK_LIBRARIES "${binary_dir}/lib/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" ) endif() else() @@ -118,8 +119,8 @@ else() set_target_properties(GTest::GTest PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" ) set_target_properties(GTest::GTest PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads @@ -131,8 +132,8 @@ else() set_target_properties(GTest::Main PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${DEBUG_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${XCODE_PREFIX}${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" ) endif() endif()