From b6220b91745c5ac56757f27713d3d2a9e1892267 Mon Sep 17 00:00:00 2001 From: Thomas Khyn Date: Mon, 23 Apr 2018 04:26:28 +1200 Subject: [PATCH] MinGW / Windows fixes (#260) * Add MINGW_HAS_SECURE_API flag for mingw compiler * Use cmd rather than powershell to get GIT_VERSION on windows powershell causes cmake to hang --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 914a761..ba5b411 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ SET(MAJOR_VERSION 1) IF ( NOT VERSION ) IF ( "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows" ) message("windows: Extracting git software version") - execute_process(COMMAND powershell "(git rev-list --branches HEAD | Measure-Object -line).Lines" OUTPUT_VARIABLE GIT_VERSION WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process(COMMAND cmd /c "git rev-list --branches HEAD | find /v "" /c" OUTPUT_VARIABLE GIT_VERSION WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) ELSE() IF(UNIX OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") message( STATUS "nix: Extracting git software version" ) @@ -186,6 +186,9 @@ IF(MINGW) # # ========================================================================== INCLUDE (${g3log_SOURCE_DIR}/CPackLists.txt) + + # this enables strerror_s + ADD_DEFINITIONS(-DMINGW_HAS_SECURE_API) ENDIF() IF (NOT MSVC)