FreeRDP/client/Mac/cli/CMakeLists.txt

111 lines
3.4 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.13)
2013-08-08 23:49:24 +04:00
if (NOT FREERDP_DEFAULT_PROJECT_VERSION)
set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0")
endif()
project(MacFreeRDP
VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}
)
message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
2023-11-07 17:41:01 +03:00
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/)
2023-12-21 11:27:19 +03:00
include(CommonConfigOptions)
2023-11-07 17:41:01 +03:00
# Import libraries
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
find_library(COCOA_LIBRARY Cocoa REQUIRED)
find_library(APPKIT_LIBRARY AppKit REQUIRED)
2018-11-29 17:46:37 +03:00
string(TIMESTAMP VERSION_YEAR "%Y")
2013-06-23 08:18:55 +04:00
set(MACOSX_BUNDLE_INFO_STRING "MacFreeRDP")
set(MACOSX_BUNDLE_ICON_FILE "FreeRDP.icns")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.freerdp.mac")
set(MACOSX_BUNDLE_BUNDLE_IDENTIFIER "FreeRDP-client.Mac")
2018-11-29 17:46:37 +03:00
set(MACOSX_BUNDLE_LONG_VERSION_STRING "MacFreeRDP Client Version ${FREERDP_VERSION}")
set(MACOSX_BUNDLE_BUNDLE_NAME "MacFreeRDP")
2018-11-29 17:46:37 +03:00
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${FREERDP_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${FREERDP_VERSION})
set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013-${VERSION_YEAR}. All Rights Reserved.")
set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "MainMenu")
set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "NSApplication")
set(XIBS MainMenu.xib)
2013-08-08 23:49:24 +04:00
set(SOURCES "")
2013-08-08 23:49:24 +04:00
set(OBJECTIVE_SOURCES
2013-08-08 23:49:24 +04:00
main.m
AppDelegate.m
)
2013-08-08 23:49:24 +04:00
list(APPEND SOURCES ${OBJECTIVE_SOURCES})
2013-08-08 23:49:24 +04:00
set(HEADERS
AppDelegate.h
)
set(RESOURCES
"en.lproj/InfoPlist.strings"
${MACOSX_BUNDLE_ICON_FILE}
)
2023-11-07 17:41:01 +03:00
# Include XIB file in Xcode resources.
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}")
list(APPEND RESOURCES ${XIBS})
set(IS_XCODE ON)
2013-08-08 23:49:24 +04:00
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PkgInfo.in ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo @ONLY)
add_executable(${PROJECT_NAME}
${HEADERS}
${SOURCES}
${RESOURCES})
if (WITH_BINARY_VERSIONING)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES RESOURCE "${RESOURCES}")
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
target_link_libraries(${PROJECT_NAME} PRIVATE
${COCOA_LIBRARY}
${FOUNDATION_LIBRARY}
${APPKIT_LIBRARY}
MacFreeRDP-library
)
if (NOT IS_XCODE)
find_program(IBTOOL ibtool REQUIRED
HINTS
"/usr/bin"
"${OSX_DEVELOPER_ROOT}/usr/bin"
)
# Compile the .xib files using the 'ibtool' program with the destination being the app package
foreach(xib ${XIBS})
get_filename_component(XIB_WE ${xib} NAME_WE)
set(NIB ${CMAKE_CURRENT_BINARY_DIR}/${XIB_WE}.nib)
list(APPEND NIBS ${NIB})
add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
--compile ${NIB} ${CMAKE_CURRENT_SOURCE_DIR}/${xib}
COMMENT "Compiling ${xib}")
endforeach()
install(FILES ${NIBS} DESTINATION ${CMAKE_INSTALL_DATADIR})
endif()
install(TARGETS ${PROJECT_NAME}
COMPONENT client
RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR}
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Info.plist DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo DESTINATION ${CMAKE_INSTALL_PREFIX})