root/CMakeLists.txt @ 341

Revision 341, 3.0 kB (checked in by smidl, 15 years ago)

Compilation stuff

  • Property svn:eol-style set to native
RevLine 
[168]1# Compulsory line
2cmake_minimum_required(VERSION 2.6)
3
[19]4# The name of our project is "BDM".  CMakeLists files in this project can
5# refer to the root source directory of the project as ${BDM_SOURCE_DIR} and
6# to the root binary directory of the project as ${BDM_BINARY_DIR}.
7project (BDM)
8
[25]9# In order to be able to use the newly written FindXXX package, the
10# location of the FindXXX.cmake file must be added to the cmake modules
[35]11# list from within a CMakeLists.txt file as follows:
12set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}\\CMake_modules\\")
[25]13
[20]14######################
15#Platform specific
16IF(WIN32)
[111]17# IF YOU WANT TO USE YOUR OWN INSTALLATION OF THE NEXT EXTERNAL LIBRARIES,
[319]18# THEN IT IS NECESSARY TO CREATE TEXT FILE "\system\WIN32\LOCAL_PATHS.TXT" WITH
[316]19# COPIES OF THE TWO FOLLOWING LINES AND THEN CORECT ALL THE INVOLVED PATHS
[319]20        SET(ITPP_DIR "${BDM_SOURCE_DIR}\\system\\\\win32\\itpp-4.0.6")
21        SET(ACML_DIR "${BDM_SOURCE_DIR}\\system\\win32\\acml3.6.0")
[35]22
[319]23        INCLUDE(\\system\\win32\\local_paths.txt OPTIONAL)     
[208]24        ADD_DEFINITIONS(-DHAVE_ACML)
[303]25ENDIF(WIN32)
26IF(APPLE)
27        SET(ITPP_DIR "${BDM_SOURCE_DIR}\\macosx\\itpp-4.0.6")
28        FIND_LIBRARY(FRAMEWORK_VECLIB vecLib)
29        ADD_DEFINITIONS(-DHAVE_XLOCALE_H)
30ENDIF(APPLE)
31IF(UNIX)
[113]32        #This is for UNIX makefile which does only one release at a time.
[285]33        SET(CMAKE_BUILD_TYPE Debug)
[307]34        SET(CMAKE_CXX_FLAGS "-Wall -pipe  -Wno-unknown-pragmas -fPIC")
35        SET(CMAKE_C_FLAGS "-Wall -pipe  -Wno-unknown-pragmas -fPIC")
[218]36        SET(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG -O2")
[260]37        SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
[270]38        #ADD_DEFINITIONS(-DNDEBUG)
[320]39       
40        SET(MATLAB_ROOT ~/bin/matlab2008a)
41        # MATLAB_ROOT can be setup in Local
[303]42ENDIF(UNIX)
[35]43
[320]44# Local ettings should be written to file called CMakeLists.local
45# Use this option for machine-specific options, such as prallel architectures
46INCLUDE(CMakeLists.local OPTIONAL)     
47
[113]48FIND_PACKAGE(ITPP REQUIRED)
49FIND_PACKAGE(ACML COMPONENTS)
[320]50FIND_PACKAGE(Matlab COMPONENTS)
51FIND_PROGRAM(MEX_COMPILER mex)
[25]52
[113]53IF(ITPP_FOUND)
54        INCLUDE_DIRECTORIES(${ITPP_INCLUDE_DIR})
55        LINK_DIRECTORIES(${NATIVE_ITPP_LIB_PATH})
56ENDIF(ITPP_FOUND)
[25]57
[113]58IF(ACML_FOUND)
59        INCLUDE_DIRECTORIES(${ACML_INCLUDE_DIR})
60        LINK_DIRECTORIES(${NATIVE_ACML_LIB_PATH})
61ENDIF(ACML_FOUND)
[25]62
[222]63##
64## PREPARE MACROS for building executables
65##
66
67MACRO(EXEC FN)
68        add_executable (${FN} ${FN}.cpp)
[303]69        IF(WIN32)
[279]70                target_link_libraries (${FN} debug itpp_debug)
71                target_link_libraries (${FN} optimized itpp)
72                target_link_libraries (${FN} libacml_dll)
[303]73        ELSE(WIN32)
74                IF(APPLE)
75                        target_link_libraries (${FN} ${FRAMEWORK_VECLIB})
76                ENDIF(APPLE)
[341]77#               target_link_libraries (${FN} itpp)     
78                target_link_libraries (${FN} debug itpp_debug)
79                target_link_libraries (${FN} optimized itpp)
[280]80        ENDIF(WIN32)
[279]81        target_link_libraries (${FN} bdm)
[222]82        target_link_libraries (${FN} ${ARGN}) ## Additional libraries can be added to a macro
83ENDMACRO(EXEC)
[320]84       
[222]85
86
[19]87# Recurse into the "dbm" and "tests" subdirectories.  This does not actually
88# cause another cmake executable to run.  The same process will walk through
89# the project's entire directory structure.
90add_subdirectory (bdm)
[134]91add_subdirectory (tests)
[319]92add_subdirectory (applications)
[271]93add_subdirectory (library)
Note: See TracBrowser for help on using the browser.