CMakeListsStaticInclude.txt 2.3 KB
Newer Older
1 2 3 4 5 6
#
# To build ACGL as a library, use the CMakeLists.txt
# To build it statically into a project just include this file,
# e.g.: INCLUDE(${CMAKE_SOURCE_DIR}/extern/acgl/CMakeListsStaticInclude.txt)
#

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
################################################################################
# Macro to sort acgl into directories
################################################################################

MACRO (RECURSE_GROUPS dirname)
    FILE(GLOB_RECURSE allfiles "${dirname}/*.*")
    SET(ALL_FILES ${ALL_FILES} ${allfiles})
    STRING(REGEX REPLACE ".*/([^/]*)" "\\1" maindir "${dirname}")

    FOREACH(file ${allfiles})
        STRING(REGEX REPLACE "${dirname}/(.*)/[^/]*" "\\1" loopdirname "${file}")
        STRING(REGEX REPLACE "/" "\\\\" loopdirname "${loopdirname}")

        IF(NOT "${file}" MATCHES "${dirname}/(.*)/[^/]*")
            source_group("${maindir}" FILES  ${file})
        ELSE()
            source_group("${maindir}\\${loopdirname}" FILES  ${file})
        ENDIF()
    ENDFOREACH()
ENDMACRO (RECURSE_GROUPS)
27

28
SET(ACGL_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
29
# Find all used files of certain file-types
30 31 32 33 34 35
FILE(GLOB_RECURSE SOURCE_FILES_C   "${ACGL_BASE_DIR}/src/*.c")
FILE(GLOB_RECURSE SOURCE_FILES_CC  "${ACGL_BASE_DIR}/src/*.cc")
FILE(GLOB_RECURSE SOURCE_FILES_CPP "${ACGL_BASE_DIR}/src/*.cpp")
FILE(GLOB_RECURSE HEADER_FILES_H   "${ACGL_BASE_DIR}/include/*.h")
FILE(GLOB_RECURSE HEADER_FILES_HH  "${ACGL_BASE_DIR}/include/*.hh")
FILE(GLOB_RECURSE HEADER_FILES_HPP "${ACGL_BASE_DIR}/include/*.hpp")
36 37 38
#group files in msvc
RECURSE_GROUPS ("${ACGL_BASE_DIR}/include")
RECURSE_GROUPS ("${ACGL_BASE_DIR}/src")
39 40 41 42

SET(HEADER_FILES ${HEADER_FILES} ${HEADER_FILES_H} ${HEADER_FILES_HH} ${HEADER_FILES_HPP})
SET(SOURCE_FILES ${SOURCE_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CC} ${SOURCE_FILES_CPP})

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
IF(NOT ACGL_SKIP_INCLUDE_AND_DEF)
  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/include)

  # set debug build with: cmake -DCMAKE_BUILD_TYPE=Debug ...
  IF(CMAKE_BUILD_TYPE MATCHES Debug)
      ADD_DEFINITIONS(-DDEBUG)
  ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
  IF(CMAKE_BUILD_TYPE MATCHES debug)
      ADD_DEFINITIONS(-DDEBUG)
  ENDIF(CMAKE_BUILD_TYPE MATCHES debug)
  IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
      ADD_DEFINITIONS(-DDEBUG)
  ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)

  IF(WIN32)
      ADD_DEFINITIONS(-DWIN32)
  ENDIF(WIN32)
ENDIF()