2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
2009-12-02 17:52:00 +03:00
|
|
|
|
|
|
|
|
|
|
|
# This module is shared by multiple languages; use include blocker.
|
|
|
|
if(__CYGWIN_COMPILER_GNU)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
set(__CYGWIN_COMPILER_GNU 1)
|
|
|
|
|
2010-01-21 23:03:32 +03:00
|
|
|
# TODO: Is -Wl,--enable-auto-import now always default?
|
2016-07-13 22:06:23 +03:00
|
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,--enable-auto-import")
|
2009-12-02 17:52:00 +03:00
|
|
|
set(CMAKE_CREATE_WIN32_EXE "-mwindows")
|
|
|
|
|
|
|
|
set(CMAKE_GNULD_IMAGE_VERSION
|
|
|
|
"-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>")
|
2010-12-23 23:53:47 +03:00
|
|
|
set(CMAKE_GENERATOR_RC windres)
|
2009-12-02 17:52:00 +03:00
|
|
|
macro(__cygwin_compiler_gnu lang)
|
|
|
|
# Binary link rules.
|
|
|
|
set(CMAKE_${lang}_CREATE_SHARED_MODULE
|
|
|
|
"<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
|
|
|
|
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
|
|
|
|
"<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
|
|
|
|
set(CMAKE_${lang}_LINK_EXECUTABLE
|
|
|
|
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
|
|
|
|
|
2012-05-05 23:11:35 +04:00
|
|
|
# No -fPIC on cygwin
|
|
|
|
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
|
|
|
|
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
|
|
|
|
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
|
2009-12-02 17:52:00 +03:00
|
|
|
|
|
|
|
# Initialize C link type selection flags. These flags are used when
|
|
|
|
# building a shared library, shared module, or executable that links
|
|
|
|
# to other libraries to select whether to use the static or shared
|
|
|
|
# versions of the libraries.
|
2012-08-13 21:47:32 +04:00
|
|
|
foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
|
|
|
|
set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic")
|
|
|
|
set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
2009-12-02 17:52:00 +03:00
|
|
|
|
2010-05-27 22:41:28 +04:00
|
|
|
set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols")
|
2010-01-21 23:03:32 +03:00
|
|
|
# TODO: Is -Wl,--enable-auto-import now always default?
|
|
|
|
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import")
|
2009-12-02 17:52:00 +03:00
|
|
|
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}")
|
2015-02-25 19:15:51 +03:00
|
|
|
|
2015-05-07 18:43:02 +03:00
|
|
|
if(NOT CMAKE_RC_COMPILER_INIT)
|
|
|
|
set(CMAKE_RC_COMPILER_INIT windres)
|
|
|
|
endif()
|
|
|
|
|
2015-02-25 19:15:51 +03:00
|
|
|
enable_language(RC)
|
2009-12-02 17:52:00 +03:00
|
|
|
endmacro()
|