Skip to content

Commit

Permalink
Doesn't add libgtest.a until it exists
Browse files Browse the repository at this point in the history
Closes #45
  • Loading branch information
Mayeul d'Avezac committed Apr 27, 2016
1 parent 07c53a9 commit b4c7743
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/AddGTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b4c7743

Please sign in to comment.