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)
|
set(_OSNAME darwin)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
set(_OSNAME windows)
|
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()
|
else()
|
||||||
set(_OSNAME unix)
|
set(_OSNAME unix)
|
||||||
endif()
|
endif()
|
||||||
|
@ -57,6 +62,14 @@ if(MSVC)
|
||||||
else()
|
else()
|
||||||
endif()
|
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("common")
|
||||||
add_subdirectory("${_OSNAME}")
|
add_subdirectory("${_OSNAME}")
|
||||||
add_library(${_LIBUINAME} ${_LIBUI_SOURCES})
|
add_library(${_LIBUINAME} ${_LIBUI_SOURCES})
|
||||||
|
@ -72,10 +85,10 @@ target_compile_options(${_LIBUINAME}
|
||||||
target_link_libraries(${_LIBUINAME}
|
target_link_libraries(${_LIBUINAME}
|
||||||
${_LIBUI_LINKMODE} ${_LIBUI_LIBS})
|
${_LIBUI_LINKMODE} ${_LIBUI_LIBS})
|
||||||
# on Windows the linker for static libraries is different; don't give it the flags
|
# on Windows the linker for static libraries is different; don't give it the flags
|
||||||
# TODO are these inherited?
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
set_property(TARGET ${_LIBUINAME} APPEND PROPERTY
|
_target_link_options_private(${_LIBUINAME}
|
||||||
LINK_FLAGS ${_LIBUI_LDFLAGS})
|
_COMMON_LDFLAGS
|
||||||
|
_LIBUI_LDFLAGS)
|
||||||
endif()
|
endif()
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
_handle_static()
|
_handle_static()
|
||||||
|
@ -96,4 +109,7 @@ macro(_add_exec _name)
|
||||||
WIN32 EXCLUDE_FROM_ALL
|
WIN32 EXCLUDE_FROM_ALL
|
||||||
${ARGN})
|
${ARGN})
|
||||||
target_link_libraries(${_name} libui)
|
target_link_libraries(${_name} libui)
|
||||||
|
_target_link_options_private(${_name}
|
||||||
|
_COMMON_LDFLAGS)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
add_subdirectory("test")
|
||||||
|
|
|
@ -176,8 +176,5 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory("test")
|
add_subdirectory("test")
|
||||||
set_target_properties(tester PROPERTIES
|
|
||||||
OUTPUT_NAME test
|
|
||||||
WIN32_EXECUTABLE FALSE)
|
|
||||||
|
|
||||||
add_subdirectory("examples")
|
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