target_compile_options(nana PUBLIC -static -static-libstdc++) for MINGW too

This commit is contained in:
qPCR4vir 2019-05-15 13:05:19 +02:00
parent d96efd11a6
commit fbffbcd75d
2 changed files with 34 additions and 43 deletions

View File

@ -54,27 +54,25 @@ target_compile_features(nana
# in your own CMakeLists.txt, and them : # in your own CMakeLists.txt, and them :
# target_link_libraries(yourApp PRIVATE nana ) # target_link_libraries(yourApp PRIVATE nana )
set(NANA_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/source) set(NANA_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/source)
set(NANA_SOURCE_SUBDIRS /.
set(NANA_SOURCE_SUBDIRS /detail
/. /detail/posix
/detail /filesystem
/detail/posix /gui
/filesystem /gui/detail
/gui /gui/widgets
/gui/detail /gui/widgets/skeletons
/gui/widgets /paint
/gui/widgets/skeletons /paint/detail
/paint /system
/paint/detail /threads
/system )
/threads
)
if(NANA_CMAKE_ENABLE_AUDIO) if(NANA_CMAKE_ENABLE_AUDIO)
list(APPEND NANA_SOURCE_SUBDIRS list(APPEND NANA_SOURCE_SUBDIRS
/audio /audio
/audio/detail /audio/detail
) )
endif() endif()
# collect all source files in the source-sub-dir # collect all source files in the source-sub-dir
@ -87,26 +85,24 @@ target_sources(nana PRIVATE ${SOURCES})
### collect all headers sub-directories in a list to avoid duplication ### ### collect all headers sub-directories in a list to avoid duplication ###
# To show .h files in Visual Studio, add them to the list of sources in add_executable / add_library / target_sources # To show .h files in Visual Studio, add them to the list of sources in add_executable / add_library / target_sources
# and Use SOURCE_GROUP if all your sources are in the same directory # and Use SOURCE_GROUP if all your sources are in the same directory
set(NANA_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include) set(NANA_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
set(NANA_INCLUDE_SUBDIRS /.
set(NANA_INCLUDE_SUBDIRS /filesystem
/. /gui
/filesystem /gui/detail
/gui /gui/widgets
/gui/detail /gui/widgets/skeletons
/gui/widgets /paint
/gui/widgets/skeletons /paint/detail
/paint /pat
/paint/detail /system
/pat /threads
/system )
/threads
)
if(NANA_CMAKE_ENABLE_AUDIO) if(NANA_CMAKE_ENABLE_AUDIO)
list(APPEND NANA_INCLUDE_SUBDIRS list(APPEND NANA_INCLUDE_SUBDIRS
/audio /audio
/audio/detail /audio/detail
) )
endif() endif()
foreach(subdir ${NANA_INCLUDE_SUBDIRS}) foreach(subdir ${NANA_INCLUDE_SUBDIRS})

View File

@ -40,12 +40,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # AN
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
target_compile_options(nana PUBLIC -lgcc -lstdc++) target_compile_options(nana PUBLIC -lgcc -lstdc++)
else() else()
target_compile_options(nana PUBLIC -static -static-libstdc++)
if(MINGW)
target_compile_options(nana PUBLIC -static) # -static ?? cmake knows BUILD_SHARED_LIBS
else()
target_compile_options(nana PUBLIC -static-libgcc -static-libstdc++)
endif()
endif(BUILD_SHARED_LIBS) endif(BUILD_SHARED_LIBS)
endif() endif()