diff --git a/CMakeLists.txt b/CMakeLists.txt index f811a658..266ef0fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,8 +126,8 @@ if(NOT BUILD_SHARED_LIBS) target_compile_definitions(${_LIBUINAME} PUBLIC _UI_STATIC) endif() -if(NOT WIN32) - # on non-Windows platforms cmake adds an extra lib- +if(NOT MSVC) + # on non-MSVC compilers cmake adds an extra lib- # note that we apply this to libui, not to any intermediates set_target_properties(libui PROPERTIES OUTPUT_NAME ui) diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 7119b0a3..a2175786 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -60,6 +60,7 @@ list(APPEND _LIBUI_INCLUDEDIRS ) set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE) +# Windows won't link resources in static libraries; we need to provide the libui.res file in this case. set(_LIBUINAME libui PARENT_SCOPE) if(NOT BUILD_SHARED_LIBS) set(_LIBUI_STATIC_RES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libui.res PARENT_SCOPE) @@ -72,7 +73,7 @@ macro(_handle_static) endif() # TODO this full path feels hacky add_custom_command( - TARGET libui PRE_LINK + TARGET libui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $/CMakeFiles/libui.dir/windows/resources.rc.${_res_suffix} ${_LIBUI_STATIC_RES} COMMENT "Copying libui.res") diff --git a/windows/resources.rc b/windows/resources.rc index 989dfc91..c465ee63 100644 --- a/windows/resources.rc +++ b/windows/resources.rc @@ -2,6 +2,8 @@ #include "winapi.hpp" #include "resources.hpp" +// TODO change and pin down IDs for static linking; document them + // this is a UTF-8 file #pragma code_page(65001)