2008-09-18 18:44:52 +04:00
# (c) 2008 by BogDan Vatra < bogdan@licentia.eu >
cmake_minimum_required ( VERSION 2.6 )
project ( zint-package )
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
2008-10-03 13:50:13 +04:00
#set(CMAKE_VERBOSE_MAKEFILE ON)
2008-09-18 18:51:21 +04:00
#comment or remove the above line before release
2008-09-18 18:44:52 +04:00
2008-11-18 11:52:43 +03:00
set ( ZINT_VERSION_MAJOR 2 )
2020-07-30 00:35:31 +03:00
set ( ZINT_VERSION_MINOR 9 )
2019-12-09 22:14:39 +03:00
set ( ZINT_VERSION_RELEASE 0 )
2008-09-18 18:44:52 +04:00
set ( ZINT_VERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}.${ZINT_VERSION_RELEASE}" )
2008-09-28 15:19:33 +04:00
add_definitions ( -DZINT_VERSION=\ "${ZINT_VERSION}\" -Wall )
2008-09-18 18:44:52 +04:00
set ( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
2019-09-01 22:23:15 +03:00
set ( ZINT_DEBUG FALSE CACHE BOOL "Set debug compile flag" )
set ( ZINT_SANITIZE FALSE CACHE BOOL "Set sanitize compile/link flags" )
2019-12-19 03:37:55 +03:00
set ( ZINT_TEST FALSE CACHE BOOL "Set test compile flag" )
2020-03-30 12:54:21 +03:00
set ( ZINT_STATIC FALSE CACHE BOOL "Build static library" )
2019-09-01 22:23:15 +03:00
2008-09-24 13:00:44 +04:00
include ( SetPaths.cmake )
2009-05-22 01:00:23 +04:00
INCLUDE ( CheckCXXCompilerFlag )
if ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC )
check_cxx_compiler_flag ( "-Wall" CXX_COMPILER_FLAG_WALL )
if ( CXX_COMPILER_FLAG_WALL )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
endif ( CXX_COMPILER_FLAG_WALL )
2019-09-01 22:23:15 +03:00
if ( ZINT_DEBUG )
add_compile_options ( "-g" )
add_compile_options ( "-O0" )
endif ( ZINT_DEBUG )
if ( ZINT_SANITIZE )
add_compile_options ( "-fsanitize=undefined" )
add_compile_options ( "-fsanitize=address" )
2019-12-16 20:31:52 +03:00
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address" )
2019-09-01 22:23:15 +03:00
endif ( ZINT_SANITIZE )
2019-12-19 03:37:55 +03:00
if ( ZINT_TEST )
add_definitions ( "-DZINT_TEST" )
endif ( ZINT_TEST )
2009-05-22 01:00:23 +04:00
endif ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC )
2009-02-06 11:44:09 +03:00
IF ( APPLE )
2012-12-30 17:55:05 +04:00
IF ( UNIVERSAL ) # TODO: make univeral binary
IF ( NOT ZINT_HAS_BEEN_RUN_BEFORE and UNIVERAL )
2010-02-28 06:44:54 +03:00
IF ( EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk )
SET ( CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module " CACHE STRING "Flags used by the compiler during all build types." FORCE )
ELSE ( EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk )
IF ( EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk )
SET ( CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module " CACHE STRING "Flags used by the compiler during all build types." FORCE )
ENDIF ( EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk )
ENDIF ( EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk )
message ( "Build architectures for OSX:${CMAKE_OSX_ARCHITECTURES}" )
ENDIF ( NOT ZINT_HAS_BEEN_RUN_BEFORE )
ELSE ( UNIVERSAL )
SET ( CMAKE_OSX_SYSROOT "/" )
ENDIF ( UNIVERSAL )
IF ( PNG_FOUND )
INCLUDE_DIRECTORIES (
" $ { P N G _ I N C L U D E _ D I R } "
)
SET ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpng" )
SET ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lpng" )
SET ( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lpng" )
ENDIF ( PNG_FOUND )
2009-02-06 11:44:09 +03:00
ENDIF ( APPLE )
2008-09-18 18:44:52 +04:00
add_subdirectory ( backend )
add_subdirectory ( frontend )
2016-12-11 18:29:06 +03:00
find_package ( Qt5Widgets )
find_package ( Qt5Gui )
find_package ( Qt5UiTools )
if ( Qt5Widgets_FOUND )
if ( Qt5Gui_FOUND )
if ( Qt5UiTools_FOUND )
set ( QT_USE_QTGUI TRUE )
set ( QT_USE_QTUITOOLS TRUE )
set ( QT_USE_QTXML TRUE )
include_directories (
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
$ { Q t 5 W i d g e t s _ I N C L U D E S }
$ { Q t 5 G u i _ I N C L U D E S }
$ { Q t 5 U i T o o l s _ I N C L U D E S }
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
)
add_subdirectory ( backend_qt )
add_subdirectory ( frontend_qt )
endif ( Qt5UiTools_FOUND )
endif ( Qt5Gui_FOUND )
endif ( Qt5Widgets_FOUND )
2008-09-18 21:07:17 +04:00
CONFIGURE_FILE (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
ADD_CUSTOM_TARGET ( uninstall
" $ { C M A K E _ C O M M A N D } " - P " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e " )
2015-09-14 22:47:07 +03:00
# staniek: don't install
if ( DATA_INSTALL_DIR )
set ( CMAKE_MODULES_INSTALL_PATH ${ DATA_INSTALL_DIR } /cmake/modules )
else ( DATA_INSTALL_DIR )
set ( CMAKE_MODULES_INSTALL_PATH ${ CMAKE_ROOT } /Modules )
endif ( DATA_INSTALL_DIR )
install ( FILES cmake/modules/FindZint.cmake DESTINATION ${ CMAKE_MODULES_INSTALL_PATH } COMPONENT Devel )
2009-05-20 12:32:33 +04:00
# This needs to be run very last so other parts of the scripts can take
# advantage of this.
IF ( NOT ZINT_HAS_BEEN_RUN_BEFORE )
SET ( ZINT_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before" )
ENDIF ( NOT ZINT_HAS_BEEN_RUN_BEFORE )