CMakeLists.txt 3.75 KB
Newer Older
1 2 3
#
# Use this to compile ACGL as a library. To include it statically compiled into 
# your own project you can also just include the CMakeListsStaticInclude.txt:
4
# INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsStaticInclude.txt)
5
#
6 7
CMAKE_MINIMUM_REQUIRED (VERSION 2.6) 

8
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeMacros.txt)
9

10 11 12 13 14 15
################################################################################
# Global Settings
################################################################################

# Name of the Project 
PROJECT(ACGL)
16
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompileOptions.txt)
17 18 19

# Specify dependencies
SET(NEED_ACGL_GLOBAL_EXTERN_DIR TRUE)
20
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GlobalAndLocalExternACGL.txt)
21 22

# OpenGL Support
23 24
IF(NOT DEFINED ACGL_OPENGL_SUPPORT)
    SET(ACGL_OPENGL_SUPPORT CORE_42 CACHE STRING "")
25
    SET_PROPERTY(CACHE ACGL_OPENGL_SUPPORT PROPERTY STRINGS CORE_32 CORE_33 CORE_40 CORE_41 CORE_42 CORE_43 CORE_42 FULL_21 FULL_30 FULL_31 FULL_32 FULL_33 FULL_40 FULL_41 FULL_42 FULL_43 ES_20)
26
ENDIF()
27

28 29 30 31 32
# Error Level
IF(NOT DEFINED ACGL_ERROR_LEVEL)
    SET(ACGL_ERROR_LEVEL EC0 CACHE STRING "")
    SET_PROPERTY(CACHE ACGL_ERROR_LEVEL PROPERTY STRINGS EC0 EC1 EC2 EC3)
ENDIF()
33

34 35 36 37
# UseQT
IF(NOT DEFINED ACGL_COMPILE_WITH_QT)
    SET(ACGL_COMPILE_WITH_QT Yes CACHE STRING "")
    SET_PROPERTY(CACHE ACGL_COMPILE_WITH_QT PROPERTY STRINGS Yes No)
38 39
ENDIF()

40 41 42 43 44
################################################################################
# Basic Configuration
################################################################################

# Where to find the cmake finders?
45
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
46 47 48 49 50 51 52

# Target directory
SET(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib")

################################################################################
# Project Files
################################################################################
53

54 55 56 57
#
# if ACGL should not get compiled as a library, just include the following file 
# into the projects CMakeList.txt
#
Janis Born's avatar
Janis Born committed
58
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsStaticInclude.txt)
59

60 61 62
################################################################################
# Defines
################################################################################
63

64
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DefinesACGL.txt)
Lars Krecklau's avatar
Lars Krecklau committed
65
ADD_DEFINITIONS(${ACGL_DEFINES})
66

67 68 69
################################################################################
# External Libraries
################################################################################
70

71
# Qt
72
IF(ACGL_COMPILE_WITH_QT)
73
    #MESSAGE("QT")
74 75 76 77
    SET(QT_USE_QTOPENGL TRUE)
    FIND_PACKAGE(Qt4 REQUIRED)
    INCLUDE(${QT_USE_FILE})
    SET(LIBRARIES ${LIBRARIES} ${QT_LIBRARIES})
78
ENDIF()
79

80 81 82 83 84 85 86 87 88 89 90 91 92
# static linking for MSVC
IF(ACGL_STATIC_RUNTIME_ENV)
if(MSVC)
        foreach(flag
                CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
                CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
            if(${flag} MATCHES "/MD")
                string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
            endif()
        endforeach()
    endif()
ENDIF()

93 94 95
################################################################################
# Final Definition
################################################################################
96

97 98 99 100 101 102 103
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
elseif(CMAKE_COMPILER_IS_GNUCXX)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(MSVC)
endif()

104
# Define the Project, add all required sources and dependencies to it
Lars Krecklau's avatar
Lars Krecklau committed
105 106
ADD_LIBRARY(ACGL${COMPILE_POSTFIX} STATIC ${SOURCE_FILES} ${HEADER_FILES})
TARGET_LINK_LIBRARIES(ACGL${COMPILE_POSTFIX} ${LIBRARIES})
107
#MESSAGE(${LIBRARY_NAME})