More fixups to the previous commit.

This commit is contained in:
Pietro Gagliardi 2016-06-04 14:30:43 -04:00
parent 7d2f364256
commit 66fde9ee0c
3 changed files with 6 additions and 3 deletions

View File

@ -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)

View File

@ -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 $<TARGET_PROPERTY:libui,BINARY_DIR>/CMakeFiles/libui.dir/windows/resources.rc.${_res_suffix} ${_LIBUI_STATIC_RES}
COMMENT "Copying libui.res")

View File

@ -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)