build(win32): Link wintoast correctly
This commit is contained in:
parent
f967b9ed46
commit
df91d845f7
2 changed files with 9 additions and 23 deletions
|
|
@ -455,8 +455,6 @@ endmacro()
|
||||||
#
|
#
|
||||||
macro(configure_windows_libs)
|
macro(configure_windows_libs)
|
||||||
|
|
||||||
configure_wintoast()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS
|
set(CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
|
"${CMAKE_CXX_FLAGS} /MP /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2 /Ob2")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2 /Ob2")
|
||||||
|
|
@ -563,19 +561,3 @@ macro(configure_coverage)
|
||||||
message(STATUS "Code coverage is disabled")
|
message(STATUS "Code coverage is disabled")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(configure_wintoast)
|
|
||||||
# WinToast is a pretty niche library, and there doesn't seem to be an installable package,
|
|
||||||
# so we rely on building from source.
|
|
||||||
file(GLOB WINTOAST_DIR ${PROJECT_SOURCE_DIR}/subprojects/WinToast-*)
|
|
||||||
if(WINTOAST_DIR)
|
|
||||||
set(HAVE_WINTOAST true)
|
|
||||||
add_definitions(-DHAVE_WINTOAST=1)
|
|
||||||
include_directories(${WINTOAST_DIR}/include)
|
|
||||||
else()
|
|
||||||
find_package(unofficial-wintoast CONFIG REQUIRED)
|
|
||||||
set(wintoast-lib unofficial::wintoast::wintoast)
|
|
||||||
message(WARNING "Subproject 'WinToast' not found")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endmacro()
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,11 @@ else()
|
||||||
message(STATUS "tomlplusplus INC DIR: ${tomlPP_inc_dir}")
|
message(STATUS "tomlplusplus INC DIR: ${tomlPP_inc_dir}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
find_package(unofficial-wintoast CONFIG REQUIRED)
|
||||||
|
set(wintoast-lib unofficial::wintoast::wintoast)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(lib_name app)
|
set(lib_name app)
|
||||||
|
|
||||||
file(GLOB headers "*.h" "languages/*.h")
|
file(GLOB headers "*.h" "languages/*.h")
|
||||||
|
|
@ -62,10 +67,6 @@ if(WIN32)
|
||||||
file(GLOB arch_headers "win32/*.h")
|
file(GLOB arch_headers "win32/*.h")
|
||||||
file(GLOB arch_sources "win32/*.cpp")
|
file(GLOB arch_sources "win32/*.cpp")
|
||||||
|
|
||||||
if(HAVE_WINTOAST)
|
|
||||||
list(APPEND arch_sources ${WINTOAST_DIR}/src/wintoastlib.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
file(GLOB arch_headers "unix/*.h")
|
file(GLOB arch_headers "unix/*.h")
|
||||||
file(GLOB arch_sources "unix/*.cpp")
|
file(GLOB arch_sources "unix/*.cpp")
|
||||||
|
|
@ -79,6 +80,10 @@ if(ADD_HEADERS_TO_SOURCES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${lib_name} STATIC ${sources})
|
add_library(${lib_name} STATIC ${sources})
|
||||||
|
if(WIN32)
|
||||||
|
target_compile_definitions(${lib_name} PUBLIC HAVE_WINTOAST)
|
||||||
|
target_link_libraries(${lib_name} PRIVATE ${cli11_lib} ${tomlPP_lib} ${wintoast-lib})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${lib_name}
|
${lib_name}
|
||||||
|
|
@ -100,7 +105,6 @@ if(UNIX)
|
||||||
server
|
server
|
||||||
${cli11_lib}
|
${cli11_lib}
|
||||||
${tomlPP_lib}
|
${tomlPP_lib}
|
||||||
${wintoast-lib}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue