diff options
author | Chris Robinson <[email protected]> | 2016-11-22 15:47:46 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-11-22 15:47:46 -0800 |
commit | fcb669f803d37be80492879801fba9c9011f7edf (patch) | |
tree | 455e02b634282f679b8ebfc7627b2aff911afc70 | |
parent | 49fd154829604cbe050e51694aa4932a6e00609d (diff) |
Set the windows subsystem for DLLs on MSVC and GCC on Windows
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ec81aed..7a02a48f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1235,6 +1235,14 @@ ENDIF() IF(HAVE_JACK) SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS}) ENDIF() +IF(WIN32) + IF(MSVC) + SET_PROPERTY(TARGET ${LIBNAME} APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS") + ELSEIF(CMAKE_COMPILER_IS_GNUCC) + SET_PROPERTY(TARGET ${LIBNAME} APPEND_STRING PROPERTY LINK_FLAGS " -mwindows") + ENDIF() +ENDIF() + SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION} SOVERSION ${LIB_MAJOR_VERSION}) IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") @@ -1252,7 +1260,7 @@ IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation") ENDIF() ELSE() - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBNAME}.def") + SET_PROPERTY(TARGET ${LIBNAME} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--output-def,${LIBNAME}.def") ADD_CUSTOM_COMMAND(TARGET ${LIBNAME} POST_BUILD COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" ${LIBNAME}.def COMMAND "${DLLTOOL_EXECUTABLE}" -d ${LIBNAME}.def -l ${LIBNAME}.lib -D ${LIBNAME}.dll |