Changeset 2296


Ignore:
Timestamp:
09/14/11 14:39:50 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: Introduced CMAKE_BUILD_TYPE option

Test Programs: build asap

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Introduced CMAKE_BUILD_TYPE option in cmaking.
Options are: Release, Debug, RelWithDebInfo, MinSizeRel, Profile.
Default is RelWithDebInfo.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r2289 r2296  
    3131endif()
    3232
     33
    3334# project name is ASAP
    3435project( ASAP )
    3536
    36 # flags
     37
     38#
     39# build type and their flags
     40#
     41# CMAKE_BUILD_TYPE (Release, Debug, RelWithDebInfo, MinSizeRel, Profile)
     42# default is RelWithDebInfo
     43#
     44if ( NOT CMAKE_BUILD_TYPE )
     45   set( CMAKE_BUILD_TYPE RelWithDebInfo )
     46endif()
     47message( STATUS "CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE} )
     48
     49# flags for Debug build
     50if ( CMAKE_BUILD_TYPE STREQUAL Debug )
     51   add_definitions( -DAIPS_DEBUG )
     52endif()
     53set( CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -O0 -fno-omit-frame-pointer" )
     54
     55# flags for Profile build
     56set( CMAKE_CXX_FLAGS_PROFILE "-g -O2 -pg -fprofile-arcs -fno-omit-frame-pointer" )
     57
     58# flags for Release build
     59set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wl,-s" )
     60
     61# flags for MinSizeRel build
     62set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Wl,-s" )
     63
     64# default flags
    3765set( DEFAULT_CXX_FLAGS
    38      "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment -O3 -fno-omit-frame-pointer" )
     66     "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment" )
     67
    3968find_package( OpenMP )
    4069if( OPENMP_FOUND )
    4170   set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
    4271endif()
    43 
    44 set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
    45   -DCASA_USECASAPATH
    46   -DCASACORE_NEEDS_RETHROW
    47   -DAIPS_STDLIB
    48   -DAIPS_AUTO_STL
    49   -D_GNU_SOURCE )
    50 
    51 if( CMAKE_SYSTEM_NAME STREQUAL Linux )
    52   set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
    53     -D_FILE_OFFSET_BITS=64
    54     -D_LARGEFILE_SOURCE
    55     )
    56 endif()
    57 
    58 add_definitions( ${CASACORE_DEFINITIONS} )
    59 
    60 # set flags for cpp compiler
    61 set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
    6272
    6373# environment dependent settings
     
    98108   endif()
    99109endif()
     110
     111# set flags for cpp compiler
     112set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
     113
     114
     115#
     116# casacore definitions
     117#
     118set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
     119  -DCASA_USECASAPATH
     120  -DCASACORE_NEEDS_RETHROW
     121  -DAIPS_STDLIB
     122  -DAIPS_AUTO_STL
     123  -D_GNU_SOURCE )
     124
     125if( CMAKE_SYSTEM_NAME STREQUAL Linux )
     126  set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
     127    -D_FILE_OFFSET_BITS=64
     128    -D_LARGEFILE_SOURCE
     129    )
     130endif()
     131
     132add_definitions( ${CASACORE_DEFINITIONS} )
    100133
    101134
Note: See TracChangeset for help on using the changeset viewer.