More cmake stuff. MSVC shared builds work as we want them to so far (mostly).
This commit is contained in:
parent
44b4d24881
commit
05b542182a
|
@ -13,6 +13,11 @@ if(APPLE)
|
|||
set(_OSNAME darwin)
|
||||
elseif(WIN32)
|
||||
set(_OSNAME windows)
|
||||
|
||||
# and don't include the default libraries with ANY of the builds
|
||||
# note the CACHE FORCE stuff is required here
|
||||
set(CMAKE_C_STANDARD_LIBRARIES CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES CACHE STRING "" FORCE)
|
||||
else()
|
||||
set(_OSNAME unix)
|
||||
endif()
|
||||
|
@ -57,6 +62,14 @@ if(MSVC)
|
|||
else()
|
||||
endif()
|
||||
|
||||
# TODO why do I need to do this? why doesn't target_link_libraries() work?
|
||||
macro(_target_link_options_private _target)
|
||||
foreach(_opt IN LISTS ${ARGN})
|
||||
set_property(TARGET ${_target} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " ${_opt}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
add_subdirectory("common")
|
||||
add_subdirectory("${_OSNAME}")
|
||||
add_library(${_LIBUINAME} ${_LIBUI_SOURCES})
|
||||
|
@ -72,10 +85,10 @@ target_compile_options(${_LIBUINAME}
|
|||
target_link_libraries(${_LIBUINAME}
|
||||
${_LIBUI_LINKMODE} ${_LIBUI_LIBS})
|
||||
# on Windows the linker for static libraries is different; don't give it the flags
|
||||
# TODO are these inherited?
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set_property(TARGET ${_LIBUINAME} APPEND PROPERTY
|
||||
LINK_FLAGS ${_LIBUI_LDFLAGS})
|
||||
_target_link_options_private(${_LIBUINAME}
|
||||
_COMMON_LDFLAGS
|
||||
_LIBUI_LDFLAGS)
|
||||
endif()
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
_handle_static()
|
||||
|
@ -96,4 +109,7 @@ macro(_add_exec _name)
|
|||
WIN32 EXCLUDE_FROM_ALL
|
||||
${ARGN})
|
||||
target_link_libraries(${_name} libui)
|
||||
_target_link_options_private(${_name}
|
||||
_COMMON_LDFLAGS)
|
||||
endmacro()
|
||||
add_subdirectory("test")
|
||||
|
|
|
@ -176,8 +176,5 @@ else()
|
|||
endif()
|
||||
|
||||
add_subdirectory("test")
|
||||
set_target_properties(tester PROPERTIES
|
||||
OUTPUT_NAME test
|
||||
WIN32_EXECUTABLE FALSE)
|
||||
|
||||
add_subdirectory("examples")
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
# 3 june 2016
|
||||
|
||||
if(WIN32)
|
||||
set(_TEST_RESOURCES_RC resources.rc)
|
||||
endif()
|
||||
|
||||
_add_exec(tester
|
||||
drawtests.c
|
||||
main.c
|
||||
menus.c
|
||||
page1.c
|
||||
page10.c
|
||||
page11.c
|
||||
page12.c
|
||||
page13.c
|
||||
page2.c
|
||||
page3.c
|
||||
page4.c
|
||||
page5.c
|
||||
page6.c
|
||||
page7.c
|
||||
page7a.c
|
||||
page7b.c
|
||||
page7c.c
|
||||
page8.c
|
||||
page9.c
|
||||
spaced.c
|
||||
${_TEST_RESOURCES_RC}
|
||||
)
|
||||
target_include_directories(tester
|
||||
PRIVATE test
|
||||
)
|
||||
set_target_properties(tester PROPERTIES
|
||||
OUTPUT_NAME test
|
||||
WIN32_EXECUTABLE FALSE
|
||||
)
|
Loading…
Reference in New Issue