Further windows fixes

This commit is contained in:
Sebastian Messmer 2018-07-08 19:58:30 -07:00
parent 12105fe1ce
commit 30874135a2
3 changed files with 12 additions and 6 deletions

View File

@ -56,12 +56,12 @@ find_package(CURL REQUIRED)
target_include_directories(${PROJECT_NAME} PUBLIC ${CURL_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} PUBLIC ${CURL_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${CURL_LIBRARIES}) target_link_libraries(${PROJECT_NAME} PUBLIC ${CURL_LIBRARIES})
if(WIN32) if(NOT WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC DbgHelp)
else()
find_package(Backtrace REQUIRED) find_package(Backtrace REQUIRED)
target_include_directories(${PROJECT_NAME} PUBLIC ${Backtrace_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} PUBLIC ${Backtrace_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${Backtrace_LIBRARIES}) target_link_libraries(${PROJECT_NAME} PUBLIC ${Backtrace_LIBRARIES})
else()
target_link_libraries(${PROJECT_NAME} PUBLIC DbgHelp)
endif() endif()
find_package(Threads REQUIRED) find_package(Threads REQUIRED)

View File

@ -2,7 +2,7 @@ set(DIR_OF_GITVERSION_TOOL "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "DIR_OF_GI
function (get_git_version OUTPUT_VARIABLE) function (get_git_version OUTPUT_VARIABLE)
EXECUTE_PROCESS(COMMAND python ${DIR_OF_GITVERSION_TOOL}/getversion.py EXECUTE_PROCESS(COMMAND python ${DIR_OF_GITVERSION_TOOL}/getversion.py
WORKING_DIRECTORY ${DIR_OF_GITVERSION_TOOL} WORKING_DIRECTORY ${DIR_OF_GITVERSION_TOOL}
OUTPUT_VARIABLE VERSION OUTPUT_VARIABLE VERSION
ERROR_VARIABLE error ERROR_VARIABLE error
RESULT_VARIABLE result) RESULT_VARIABLE result)

View File

@ -1,6 +1,10 @@
include(CTest) include(CTest)
if (BUILD_TESTING) if (BUILD_TESTING)
# Fix how gtest links the C library on windows, see https://github.com/google/googletest/blob/4e4df226fc197c0dda6e37f5c8c3845ca1e73a49/googletest/README.md
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(INSTALL_GTEST off CACHE BOOL "" FORCE)
set(INSTALL_GMOCK off CACHE BOOL "" FORCE)
add_subdirectory(gtest EXCLUDE_FROM_ALL) add_subdirectory(gtest EXCLUDE_FROM_ALL)
project (googletest) project (googletest)
@ -10,5 +14,7 @@ if (BUILD_TESTING)
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE ${gtest_INCLUDE_DIRS}/include SYSTEM ${gmock_INCLUDE_DIRS}/include) target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE ${gtest_INCLUDE_DIRS}/include SYSTEM ${gmock_INCLUDE_DIRS}/include)
# Disable "missing override" warning because gmock MOCK_METHOD() don't use override :( # Disable "missing override" warning because gmock MOCK_METHOD() don't use override :(
target_compile_options(${PROJECT_NAME} PUBLIC "-Wno-inconsistent-missing-override") if (NOT WIN32)
endif (BUILD_TESTING) target_compile_options(${PROJECT_NAME} PUBLIC "-Wno-inconsistent-missing-override")
endif()
endif()