1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-01 13:13:53 +00:00

Fix for Windows MSVC 2017 and GoogleTest

This commit is contained in:
Henry Fredrick Schreiner 2018-04-04 15:58:02 +02:00 committed by Henry Schreiner
parent 67c4eb71e5
commit 20b7232c47
2 changed files with 16 additions and 2 deletions

View File

@ -80,3 +80,10 @@ BUILD_GTEST
set_target_properties(gtest gtest_main gmock gmock_main set_target_properties(gtest gtest_main gmock gmock_main
PROPERTIES FOLDER "Extern") PROPERTIES FOLDER "Extern")
if(MSVC AND MSVC_VERSION GREATER_EQUAL 1900)
target_compile_definitions(gtest PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
target_compile_definitions(gtest_main PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
target_compile_definitions(gmock PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
target_compile_definitions(gmock_main PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
endif()

View File

@ -55,11 +55,18 @@ target_link_libraries(link_test_2 PUBLIC CLI11 link_test_1)
add_gtest(link_test_2) add_gtest(link_test_2)
# Add informational printout # Add informational printout
# Force this to be in a standard location so CTest can find it
add_executable(informational informational.cpp) add_executable(informational informational.cpp)
target_link_libraries(informational PUBLIC CLI11) target_link_libraries(informational PUBLIC CLI11)
set_property(TARGET informational PROPERTY set_target_properties(informational PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}"
)
# Adding this printout to CTest
file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake" file(WRITE "${PROJECT_BINARY_DIR}/CTestCustom.cmake"
"set(CTEST_CUSTOM_PRE_TEST \"${CMAKE_BINARY_DIR}/informational\")" "set(CTEST_CUSTOM_PRE_TEST \"${CMAKE_BINARY_DIR}/informational\")"
) )