mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-05-20 18:34:29 -05:00
fix mingw support
This commit is contained in:
parent
7510e3c553
commit
86e4eb9252
@ -49,9 +49,9 @@ target_compile_definitions(osslsigncode PRIVATE HAVE_CONFIG_H=1)
|
|||||||
|
|
||||||
# set sources
|
# set sources
|
||||||
target_sources(osslsigncode PRIVATE osslsigncode.c msi.c)
|
target_sources(osslsigncode PRIVATE osslsigncode.c msi.c)
|
||||||
if(WIN32)
|
if(NOT UNIX)
|
||||||
target_sources(osslsigncode PRIVATE applink.c)
|
target_sources(osslsigncode PRIVATE applink.c)
|
||||||
endif(WIN32)
|
endif(NOT UNIX)
|
||||||
|
|
||||||
# set include directories
|
# set include directories
|
||||||
target_include_directories(osslsigncode PRIVATE "${PROJECT_BINARY_DIR}")
|
target_include_directories(osslsigncode PRIVATE "${PROJECT_BINARY_DIR}")
|
||||||
@ -81,7 +81,9 @@ include(CMakeTest)
|
|||||||
|
|
||||||
# installation rules for a project
|
# installation rules for a project
|
||||||
install(TARGETS osslsigncode RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
install(TARGETS osslsigncode RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
if(WIN32)
|
if(UNIX)
|
||||||
|
include(CMakeDist)
|
||||||
|
else(UNIX)
|
||||||
install(
|
install(
|
||||||
DIRECTORY ${PROJECT_BINARY_DIR}/ DESTINATION ${CMAKE_INSTALL_PREFIX}
|
DIRECTORY ${PROJECT_BINARY_DIR}/ DESTINATION ${CMAKE_INSTALL_PREFIX}
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
@ -90,6 +92,4 @@ if(WIN32)
|
|||||||
PATTERN "CMakeFiles" EXCLUDE
|
PATTERN "CMakeFiles" EXCLUDE
|
||||||
PATTERN "Testing" EXCLUDE
|
PATTERN "Testing" EXCLUDE
|
||||||
)
|
)
|
||||||
else(WIN32)
|
endif(UNIX)
|
||||||
include(CMakeDist)
|
|
||||||
endif(WIN32)
|
|
||||||
|
@ -30,7 +30,7 @@ set(sign_opt "-time" "1556708400"
|
|||||||
"-n" "osslsigncode" "-ac" "${CERTS}/crosscert.pem"
|
"-n" "osslsigncode" "-ac" "${CERTS}/crosscert.pem"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT CMAKE_HOST_WIN32)
|
if(CMAKE_HOST_UNIX)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND "${CONF}/makecerts.sh"
|
COMMAND "${CONF}/makecerts.sh"
|
||||||
WORKING_DIRECTORY ${CONF}
|
WORKING_DIRECTORY ${CONF}
|
||||||
|
@ -1,22 +1,17 @@
|
|||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(UNIX)
|
||||||
check_function_exists(getpass HAVE_GETPASS)
|
check_function_exists(getpass HAVE_GETPASS)
|
||||||
check_include_file(termios.h HAVE_TERMIOS_H)
|
check_include_file(termios.h HAVE_TERMIOS_H)
|
||||||
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
|
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
|
||||||
if(HAVE_SYS_MMAN_H)
|
if(HAVE_SYS_MMAN_H)
|
||||||
check_function_exists(mmap HAVE_MMAP)
|
check_function_exists(mmap HAVE_MMAP)
|
||||||
if(NOT HAVE_MMAP)
|
endif(HAVE_SYS_MMAN_H)
|
||||||
message(FATAL_ERROR "Error: Need mmap to build.")
|
else(UNIX)
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# include wincrypt.h in Windows.h
|
|
||||||
if(MSVC AND NOT CYGWIN)
|
|
||||||
check_include_file(windows.h HAVE_MAPVIEWOFFILE)
|
check_include_file(windows.h HAVE_MAPVIEWOFFILE)
|
||||||
if(NOT (HAVE_MMAP OR HAVE_MAPVIEWOFFILE))
|
endif(UNIX)
|
||||||
|
|
||||||
|
if(NOT (HAVE_MMAP OR HAVE_MAPVIEWOFFILE))
|
||||||
message(FATAL_ERROR "Error: Need file mapping function to build.")
|
message(FATAL_ERROR "Error: Need file mapping function to build.")
|
||||||
endif()
|
endif(NOT (HAVE_MMAP OR HAVE_MAPVIEWOFFILE))
|
||||||
endif()
|
|
||||||
|
@ -85,7 +85,7 @@ function(add_compile_flags target)
|
|||||||
target_compile_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/D_FORTIFY_SOURCE=2>)
|
target_compile_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/D_FORTIFY_SOURCE=2>)
|
||||||
# Unrecognized compiler options are errors
|
# Unrecognized compiler options are errors
|
||||||
target_compile_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/options:strict>)
|
target_compile_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/options:strict>)
|
||||||
else()
|
else(MSVC)
|
||||||
check_c_compiler_flag("-fstack-protector-all" HAVE_STACK_PROTECTOR_ALL)
|
check_c_compiler_flag("-fstack-protector-all" HAVE_STACK_PROTECTOR_ALL)
|
||||||
if(HAVE_STACK_PROTECTOR_ALL)
|
if(HAVE_STACK_PROTECTOR_ALL)
|
||||||
target_link_options(${target} PRIVATE -fstack-protector-all)
|
target_link_options(${target} PRIVATE -fstack-protector-all)
|
||||||
@ -98,14 +98,16 @@ function(add_compile_flags target)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
# Support address space layout randomization (ASLR)
|
# Support address space layout randomization (ASLR)
|
||||||
target_compile_options(${target} PRIVATE $<$<NOT:$<C_COMPILER_ID:AppleClang>>:-fPIE>)
|
if(NOT (MINGW OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang"))
|
||||||
target_link_options(${target} PRIVATE $<$<NOT:$<C_COMPILER_ID:AppleClang>>:-fPIE -pie>)
|
target_compile_options(${target} PRIVATE -fPIE)
|
||||||
target_link_options(${target} PRIVATE $<$<NOT:$<C_COMPILER_ID:AppleClang>>:-Wl,-z,relro>)
|
target_link_options(${target} PRIVATE -fPIE -pie)
|
||||||
target_link_options(${target} PRIVATE $<$<NOT:$<C_COMPILER_ID:AppleClang>>:-Wl,-z,now>)
|
target_link_options(${target} PRIVATE -Wl,-z,relro)
|
||||||
target_link_options(${target} PRIVATE $<$<NOT:$<C_COMPILER_ID:AppleClang>>:-Wl,-z,noexecstack>)
|
target_link_options(${target} PRIVATE -Wl,-z,now)
|
||||||
|
target_link_options(${target} PRIVATE -Wl,-z,noexecstack)
|
||||||
|
endif(NOT (MINGW OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang"))
|
||||||
target_link_options(${target} PRIVATE -fstack-check)
|
target_link_options(${target} PRIVATE -fstack-check)
|
||||||
add_compile_flag_to_targets(${target})
|
add_compile_flag_to_targets(${target})
|
||||||
endif()
|
endif(MSVC)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_compile_flags(osslsigncode)
|
add_compile_flags(osslsigncode)
|
||||||
|
@ -61,9 +61,9 @@
|
|||||||
#define OPENSSL_API_COMPAT 0x10100000L
|
#define OPENSSL_API_COMPAT 0x10100000L
|
||||||
#define OPENSSL_NO_DEPRECATED
|
#define OPENSSL_NO_DEPRECATED
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(MINGW32)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
#define HAVE_WINDOWS_H
|
#define HAVE_WINDOWS_H
|
||||||
#endif /* _MSC_VER || MINGW32 */
|
#endif /* _MSC_VER || __MINGW32__ */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user