CMakeLists.txt 1.14 KB
Newer Older
1 2
 project(EXAMPLE)
cmake_minimum_required(VERSION 2.8)
3 4 5 6 7 8 9 10 11 12 13 14 15 16
# classical options 
# -DCMAKE_BUILD_TYPE=DEBUG|RELEASE 
# -G "MinGW Makefiles" 

# cmake -DCMAKE_BUILD_TYPE=DEBUG
# or
# cmake -DCMAKE_BUILD_TYPE=RELEASE
#     RELEASE is the default option (thanks to the next lines)
if( CMAKE_BUILD_TYPE )
  message(STATUS  "version : '${CMAKE_BUILD_TYPE}'")
else ()
  set( CMAKE_BUILD_TYPE RELEASE)
  message(STATUS  "default version : ${CMAKE_BUILD_TYPE}")
endif()
17 18 19 20 21 22 23 24 25 26 27 28 29 30

include("${EXAMPLE_SOURCE_DIR}/../config.txt")
if (NOT DEFINED aGrUM_DIR)
  set(aGrUM_DIR "${AGRUM_INSTALLATION_DIRECTORY}/lib/cmake/aGrUM/")
endif ()

find_package(aGrUM NO_MODULE)

if (aGrUM_FOUND)
  include(${AGRUM_USE_FILE})
else (aGrUM_FOUND)
  message(FATAL_ERROR "Please install aGrUM")
endif (aGrUM_FOUND)

31

32 33 34 35

file(GLOB EXAMPLE_SOURCE ${EXAMPLE_SOURCE_DIR}/*.cpp)
file(GLOB EXAMPLE_INCLUDE ${EXAMPLE_SOURCE_DIR}/*.h)

36
add_executable (example ${EXAMPLE_SOURCE})
37
if (${CMAKE_BUILD_TYPE}  STREQUAL "RELEASE") # release : act install release
38
  target_link_libraries(example agrum)
39
else() # debug : act install debug
40
  target_link_libraries(example agrum-dbg)
41 42
endif()

43
install (TARGETS example DESTINATION bin)
44