mirror of
https://github.com/aap/librw.git
synced 2025-12-22 02:19:56 +00:00
Resolve WinMain linking issues with CMake
This commit is contained in:
@@ -19,7 +19,6 @@ add_library(librw_skeleton
|
||||
imgui/stb_textedit.h
|
||||
imgui/stb_truetype.h
|
||||
)
|
||||
add_library(librw::skeleton ALIAS librw_skeleton)
|
||||
|
||||
set_target_properties(librw_skeleton
|
||||
PROPERTIES
|
||||
@@ -38,6 +37,20 @@ target_include_directories(librw_skeleton
|
||||
$<INSTALL_INTERFACE:${LIBRW_INSTALL_INCLUDEDIR}/skeleton>
|
||||
)
|
||||
|
||||
# HACK: When building with MinGW, it's necessary to link to libmingw32.a *before* the library
|
||||
# that provides WinMain. To work around this, an intermediate target is created when using MinGW
|
||||
# that specifies the correct linking order.
|
||||
#
|
||||
# TODO: Use SDL_main on platforms that require it
|
||||
if(MINGW AND LIBRW_PLATFORM_D3D9)
|
||||
add_library(librw_skeleton_main INTERFACE)
|
||||
find_library(MINGW32_LIBRARY NAMES mingw32)
|
||||
target_link_libraries(librw_skeleton_main INTERFACE ${MINGW32_LIBRARY} librw_skeleton)
|
||||
add_library(librw::skeleton ALIAS librw_skeleton_main)
|
||||
else()
|
||||
add_library(librw::skeleton ALIAS librw_skeleton)
|
||||
endif()
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
install(
|
||||
FILES
|
||||
|
||||
Reference in New Issue
Block a user