This repository has been archived on 2020-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
libs/qad/CMakeLists.txt

99 lines
3.0 KiB
CMake

project(qad)
cmake_minimum_required(VERSION 2.6)
include(QtProject.cmake)
if (LIBPROJECT)
include(../SDKMacros.cmake)
else()
option(LIB "System install" 1)
option(DEBUG "Build with -g3" 0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
endif ()
endif()
find_package(OpenGL REQUIRED)
if (MINGW)
find_package(MinGW REQUIRED)
endif()
#include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES})
#set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} qad_widgets qad_utils)
if (NOT LIBPROJECT)
if (LIB)
if (WIN32)
set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
else()
if(APPLE)
set(CMAKE_INSTALL_PREFIX /usr/local)
else()
set(CMAKE_INSTALL_PREFIX /usr)
endif()
endif()
message(STATUS "Install to system \"${CMAKE_INSTALL_PREFIX}\"")
else()
message(STATUS "Install to local \"bin\"")
endif()
endif()
set(CMAKES "FindQAD.cmake" "QtProject.cmake")
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
macro(qad_install _TARGET _H_FILES)
if (LIBPROJECT)
sdk_install("qad" "${_TARGET}" "${_H_FILES}")
else()
if (LIB)
if (WIN32)
if (NOT _H_FILES STREQUAL "")
#message("HFILES ${_H_FILES}")
install(FILES ${_H_FILES} DESTINATION ${MINGW_INCLUDE}/qad)
endif()
install(TARGETS ${_TARGET} DESTINATION ${MINGW_LIB})
install(TARGETS ${_TARGET} DESTINATION ${MINGW_BIN})
get_filename_component(QTDIR ${QT_QMAKE_EXECUTABLE} PATH)
install(TARGETS ${_TARGET} DESTINATION ${QTDIR})
else()
if(NOT _H_FILES STREQUAL "")
install(FILES ${_H_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad)
endif()
install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif()
else()
install(TARGETS ${_TARGET} DESTINATION bin)
endif()
endif()
endmacro()
macro(qad_plugin NAME _LIBS)
project(qad_${NAME}_plugin)
include_directories("..")
set(LIBS ${_${NAME}_LIBS} qad_${NAME} "${_LIBS}")
#message(${_${NAME}_PLUGIN_LIBS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_NO_DEBUG)
add_definitions(-DQT_SHARED)
add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
file(GLOB PMOCS "./*.h")
file(GLOB PCPPS "./*.cpp")
qt4_wrap_cpp(PCMOCS ${PMOCS} OPTIONS -nw)
add_library(${PROJECT_NAME} SHARED ${PCMOCS} ${PCPPS} ${PMOCS})
target_link_libraries(${PROJECT_NAME} ${LIBS} ${QT_QTDESIGNER_LIBRARY})
install(TARGETS ${PROJECT_NAME} DESTINATION ${QT_PLUGINS_DIR}/designer)
endmacro()
macro(qad_project NAME _LIBS)
qt_project(qad_${NAME} "LIB" "${_LIBS}" _H _CPP)
message(STATUS "Building ${PROJECT_NAME}")
qad_install(${PROJECT_NAME} "${_H}")
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin")
set(_${NAME}_PLUGIN_LIBS "${_LIBS}")
add_subdirectory(plugin)
endif()
endmacro()
set(DIRS utils widgets application blockview graphic sql_table touch_widgets)
foreach(D ${DIRS})
include_directories(${D})
add_subdirectory(${D})
endforeach(D)