CMakeLists.txt 3.38 KB
Newer Older
1
2
3
4
5
6
#
#  Copyright
#

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

7
SET(PROJECT_NAME dynamic-graph)
8
9
project(${PROJECT_NAME})

10
11
12
13
14
15
# --- PROJECT VERSION -----------------------
SET(${PROJECT_NAME}_VERSION_MAJOR "1")
SET(${PROJECT_NAME}_VERSION_MINOR "0")
SET(${PROJECT_NAME}_VERSION_PATCH "0")
SET(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")
SET(PROJECT_VERSION ${${PROJECT_NAME}_VERSION})
16
17
18

SET(CMAKE_VERBOSE_MAKEFILE true)

19
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
20
21
22
23
24
25
26
27

# Get the OS
SET(OS ${CMAKE_SYSTEM_NAME})

#----------------------------------------------------
# --- GENERIC FLAGS ---------------------------------
#----------------------------------------------------
# Specify the compile flags for the overall library.
28
29
30
31
32
33
34
35
36
37
38
39
IF(WIN32)
  SET(LIBDIR_KW "/LIBPATH:")
  SET(LIBINCL_KW "")
  SET(LIB_EXT ".lib")
ENDIF(WIN32)

IF(UNIX)
  SET(LIBDIR_KW "-L")
  SET(LIBINCL_KW "-l")
  SET(LIB_EXT "")
ENDIF(UNIX)

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Link flags
SET(${PROJECT_NAME}_LINK_SRC_FLAGS "")
SET(${PROJECT_NAME}_LINK_FLAGS "${LIBDIR_KW}${${PROJECT_NAME}_BINARY_DIR}/lib ")
SET(${PROJECT_NAME}_LINK_FLAGS "${${PROJECT_NAME}_LINK_FLAGS} ${LIBINCLUSION_KW}${${PROJECT_NAME}_INTERN_LIBS}${LIBINCLUSION_EXT}")
IF(UNIX)
  SET(${PROJECT_NAME}_LINK_SRC_FLAGS "${${PROJECT_NAME}_LINK_SRC_FLAGS} -ldl")
  SET(${PROJECT_NAME}_LINK_FLAGS "${${PROJECT_NAME}_LINK_FLAGS} -ldl")
ENDIF(UNIX)

# Release flags
IF(\"${CMAKE_BUILD_TYPE}\" STREQUAL \"\" )
ELSE(\"${CMAKE_BUILD_TYPE}\" STREQUAL \"\" )
  IF(${CMAKE_BUILD_TYPE} STREQUAL DEBUG)
    SET(${PROJECT_NAME}_CXXFLAGS ${CMAKE_CXX_FLAGS_DEBUG}) # Useless since CXX_FLAGS, not CXXFLAGS.
  ENDIF(${CMAKE_BUILD_TYPE} STREQUAL DEBUG)
  IF(${CMAKE_BUILD_TYPE} STREQUAL RELEASE)
    SET(${PROJECT_NAME}_CXXFLAGS ${CMAKE_CXX_FLAGS_RELEASE}) # Same here.
  ENDIF(${CMAKE_BUILD_TYPE} STREQUAL RELEASE)
ENDIF (\"${CMAKE_BUILD_TYPE}\" STREQUAL \"\")

# --- Default options -------------------------------------------------
OPTION(BUILD_SHARED_LIBS "Build ${PROJECT_NAME} with shared libraries." ON)
OPTION(GENERATE_DOC "Generate html documentation" OFF)

OPTION(USE_BOOST "Compile with boost." ON)

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#
# Look for dependencies
#

# Load Pkgconfig macros
INCLUDE(FindPkgConfig)
SET(PACKAGE_REQUIREMENTS "")

#
# pkg-config file
#

SET(install_pkg_prefix "\${prefix}")
SET(install_pkg_exec_prefix "\${exec_prefix}")
SET(install_pkg_libdir "\${libdir}")
SET(install_pkg_datarootdir "\${datarootdir}")
SET(install_pkg_include_dir "\${includedir}")

IF(UNIX)
  SET (${PROJECT_NAME}_LDFLAGS "-Wl,-R${install_pkg_libdir} ${LIBINCL_KW}${PROJECT_NAME}${LIB_EXT} ${${PROJECT_NAME}_LDFLAGS}")
ENDIF(UNIX)

IF(WIN32)
  SET (${PROJECT_NAME}_LDFLAGS "${LIBINCL_KW}${PROJECT_NAME}${LIB_EXT} ${${PROJECT_NAME}_LDFLAGS}")
ENDIF(WIN32)

# Install the file in the appropriate place.
SET(install_libdir_pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)

95
96
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/dynamic-graph.pc.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/dynamic-graph.pc)
97

98
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/dynamic-graph.pc
99
100
101
102
103
  DESTINATION ${install_libdir_pkgconfig}	
  PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(include)
Francois Bleibel's avatar
Francois Bleibel committed
104
ADD_SUBDIRECTORY(unitTesting)
105

106
107
108
#
# Documentation produced by doxygen
#
109
110
111
112
113
114
115
IF(GENERATE_DOC)
  INCLUDE(FindDoxygen)
  IF(DOXYGEN_FOUND)
    MESSAGE(STATUS "Doxygen found")
    add_subdirectory(doc)
  ENDIF(DOXYGEN_FOUND)
ENDIF(GENERATE_DOC)