Only check DESKTOP_APP_SPECIAL_TARGET before project().
This commit is contained in:
parent
652bbaf002
commit
7081bc283b
2 changed files with 39 additions and 19 deletions
37
validate_special_target.cmake
Normal file
37
validate_special_target.cmake
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# This file is part of Desktop App Toolkit,
|
||||
# a set of libraries for developing nice desktop applications.
|
||||
#
|
||||
# For license and copyright information please follow this link:
|
||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
|
||||
set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'mas' for Mac App Store.")
|
||||
|
||||
function(report_bad_special_target)
|
||||
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
||||
message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version" FORCE)
|
||||
else()
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "Minimum OS X deployment version" FORCE)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp"
|
||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win")
|
||||
report_bad_special_target()
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx"
|
||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mas"
|
||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac")
|
||||
report_bad_special_target()
|
||||
endif()
|
||||
else()
|
||||
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux"
|
||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux32")
|
||||
report_bad_special_target()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -4,17 +4,12 @@
|
|||
# For license and copyright information please follow this link:
|
||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
|
||||
set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'mas' for Mac App Store.")
|
||||
option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." OFF)
|
||||
option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF)
|
||||
option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON)
|
||||
option(DESKTOP_APP_USE_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF)
|
||||
option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ON)
|
||||
|
||||
function(report_bad_special_target)
|
||||
message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
|
||||
endfunction()
|
||||
|
||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
|
||||
OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp"
|
||||
OR DESKTOP_APP_SPECIAL_TARGET STREQUAL "mas")
|
||||
|
|
@ -26,11 +21,8 @@ if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
|||
set(DESKTOP_APP_USE_PACKAGED OFF)
|
||||
endif()
|
||||
|
||||
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version" FORCE)
|
||||
else()
|
||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
||||
set(DESKTOP_APP_DISABLE_SPELLCHECK ON)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "Minimum OS X deployment version" FORCE)
|
||||
endif()
|
||||
|
||||
set(build_osx 0)
|
||||
|
|
@ -41,26 +33,19 @@ set(build_linux32 0)
|
|||
if (WIN32)
|
||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp")
|
||||
set(build_winstore 1)
|
||||
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
|
||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win")
|
||||
report_bad_special_target()
|
||||
endif()
|
||||
set(DESKTOP_APP_USE_GLIBC_WRAPS OFF)
|
||||
elseif (APPLE)
|
||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx")
|
||||
set(build_osx 1)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
|
||||
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "mas")
|
||||
set(build_macstore 1)
|
||||
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL ""
|
||||
AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac")
|
||||
report_bad_special_target()
|
||||
endif()
|
||||
set(DESKTOP_APP_USE_GLIBC_WRAPS OFF)
|
||||
else()
|
||||
set(LINUX 1)
|
||||
execute_process(COMMAND uname -m OUTPUT_VARIABLE machine_uname)
|
||||
if (NOT ${machine_uname} MATCHES "x86_64" AND NOT ${machine_uname} MATCHES "aarch64")
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(build_linux32 1)
|
||||
endif()
|
||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux")
|
||||
|
|
@ -71,8 +56,6 @@ else()
|
|||
if (NOT build_linux32)
|
||||
report_bad_special_target()
|
||||
endif()
|
||||
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
||||
report_bad_special_target()
|
||||
endif()
|
||||
set(CMAKE_AR /usr/bin/gcc-ar)
|
||||
set(CMAKE_RANLIB /usr/bin/gcc-ranlib)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue