add osx support
This commit is contained in:
committed by
Dmitry Mikushin
parent
7f190194da
commit
7e4d006443
@@ -1,13 +1,5 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
|
||||
#
|
||||
# Here we check whether mio is being configured in isolation or as a component
|
||||
# of a larger project. To do so, we query whether the `PROJECT_NAME` CMake
|
||||
# variable has been defined. In the case it has, we can conclude mio is a
|
||||
# subproject.
|
||||
#
|
||||
# This convention has been borrowed from the Catch C++ unit testing library.
|
||||
#
|
||||
if(DEFINED PROJECT_NAME)
|
||||
set(subproject ON)
|
||||
else()
|
||||
@@ -18,7 +10,6 @@ PROJECT(tray C)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
# Generate 'compile_commands.json' for clang_complete
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
IF(WIN32)
|
||||
@@ -32,16 +23,43 @@ target_compile_features(tray_base INTERFACE c_std_99)
|
||||
|
||||
if(WIN32)
|
||||
include(WinApiLevels)
|
||||
add_compile_definitions(TRAY_WINAPI=1)
|
||||
else()
|
||||
add_library(tray INTERFACE)
|
||||
target_link_libraries(tray INTERFACE tray_base)
|
||||
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
add_compile_definitions(TRAY_APPKIT=1)
|
||||
find_library(Cocoa REQUIRED)
|
||||
else()
|
||||
PKG_CHECK_MODULES(APPINDICATOR REQUIRED appindicator3-0.1)
|
||||
IF(APPINDICATOR_FOUND)
|
||||
add_compile_definitions(TRAY_APPINDICATOR=1)
|
||||
ENDIF()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(tray::tray ALIAS tray)
|
||||
|
||||
add_executable(tray_example example.c)
|
||||
file(GLOB src
|
||||
${CMAKE_CURRENT_LIST_DIR}/*.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/*.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/*.ico
|
||||
${CMAKE_CURRENT_LIST_DIR}/*.png)
|
||||
|
||||
add_executable(tray_example ${src})
|
||||
target_link_libraries(tray_example INTERFACE tray_base)
|
||||
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
target_link_libraries(tray_example Cocoa)
|
||||
else()
|
||||
target_link_libraries(tray_example APPINDICATOR_STATIC_LIBRARIES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF(NOT WIN32)
|
||||
INSTALL(FILES tray.h DESTINATION include)
|
||||
ENDIF()
|
||||
|
||||
Reference in New Issue
Block a user