# Generated by ritual. # See the template at "ritual/templates/c_lib/CMakeLists.txt". cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) project (qt_gui_c) SET(CMAKE_VERBOSE_MAKEFILE ON) if(RITUAL_QT) set(CMAKE_AUTOMOC ON) find_package(Qt5Core CONFIG REQUIRED) endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) if(RITUAL_INCLUDE_PATH) message(STATUS "RITUAL_INCLUDE_PATH=${RITUAL_INCLUDE_PATH}") include_directories(${RITUAL_INCLUDE_PATH}) endif() if(RITUAL_LIBRARY_PATH) message(STATUS "RITUAL_LIBRARY_PATH=${RITUAL_LIBRARY_PATH}") link_directories(${RITUAL_LIBRARY_PATH}) endif() file(GLOB sources *.cpp) file(GLOB headers *.h) if(NOT(("${RITUAL_LIBRARY_TYPE}" STREQUAL "SHARED") OR ("${RITUAL_LIBRARY_TYPE}" STREQUAL "STATIC"))) message(FATAL_ERROR "RITUAL_LIBRARY_TYPE must be either SHARED or STATIC." ) endif() message(STATUS "RITUAL_LIBRARY_TYPE=${RITUAL_LIBRARY_TYPE}") add_library(qt_gui_c ${RITUAL_LIBRARY_TYPE} ${sources}) if(RITUAL_LINKED_LIBS) message(STATUS "RITUAL_LINKED_LIBS=${RITUAL_LINKED_LIBS}") target_link_libraries(qt_gui_c ${RITUAL_LINKED_LIBS}) endif() macro(add_osx_framework fwname target) find_library(FRAMEWORK_${fwname} NAMES ${fwname} PATHS ${RITUAL_FRAMEWORK_PATH} NO_DEFAULT_PATH) if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND) message(FATAL_ERROR "Framework not found: ${fwname}") else() target_link_libraries(${target} "${FRAMEWORK_${fwname}}/${fwname}") message(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}") endif() endmacro(add_osx_framework) if(RITUAL_FRAMEWORK_PATH) message(STATUS "RITUAL_FRAMEWORK_PATH=${RITUAL_FRAMEWORK_PATH}") endif() if(RITUAL_LINKED_FRAMEWORKS) message(STATUS "RITUAL_LINKED_FRAMEWORKS=${RITUAL_LINKED_FRAMEWORKS}") foreach(framework ${RITUAL_LINKED_FRAMEWORKS}) ADD_OSX_FRAMEWORK(${framework} qt_gui_c) endforeach() endif() add_definitions(-DQT_GUI_C_LIBRARY) if(RITUAL_CPP_LIB_VERSION) message(STATUS "RITUAL_CPP_LIB_VERSION=${RITUAL_CPP_LIB_VERSION}") add_definitions(-DRITUAL_CPP_LIB_VERSION=${RITUAL_CPP_LIB_VERSION}) endif() if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-deprecated-declarations -Werror=return-type") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # GCC set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-deprecated-declarations -Werror=return-type") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # don't warn about deprecated items set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") endif() if(RITUAL_COMPILER_FLAGS) message(STATUS "RITUAL_COMPILER_FLAGS=${RITUAL_COMPILER_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RITUAL_COMPILER_FLAGS}") endif() install( TARGETS qt_gui_c LIBRARY DESTINATION . ARCHIVE DESTINATION . RUNTIME DESTINATION . )