]> SALOME platform Git repositories - modules/shaper.git/blob - CMakeCommon/Common.cmake
Salome HOME
Issue #2561: CEA 2018-1 Cut
[modules/shaper.git] / CMakeCommon / Common.cmake
1 ## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 cmake_minimum_required (VERSION 2.6)
4 cmake_policy(SET CMP0011 NEW)
5
6 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
7 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
8 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
9
10 set(CMAKE_INCLUDE_CURRENT_DIR ON)
11
12 IF(WIN32)
13   ## Specific definitions: EHsc to avoid exceptions-linkage unresolved symbols
14   ADD_DEFINITIONS(-DWIN32 -D_WINDOWS /EHsc)
15 ENDIF(WIN32)
16
17 IF(UNIX)
18   IF(CMAKE_COMPILER_IS_GNUCC)
19     #C++11 is not supported on some platforms, disable it
20     #MESSAGE(STATUS "Setting -std=c++0x flag for the gcc...")
21     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
22
23     #Supporting test coverage checks (gcov) in the DEBUG mode
24     IF(USE_TEST_COVERAGE)
25       INCLUDE(CodeCoverage)
26       MESSAGE(STATUS "Setting flags for gcov support the gcc...")
27       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
28       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
29       SET(CMAKE_SHARED_LINKER_FLAGS "-lgcov")
30
31       SETUP_TARGET_FOR_COVERAGE(test_coverage  # Name for custom target.
32                                 ctest          # Name of the test driver executable that runs the tests.
33                                 coverage)      # Name of output directory.
34
35       SET(USE_TEST_COVERAGE False)
36     ENDIF(USE_TEST_COVERAGE)
37
38     #SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -E")
39     #MESSAGE(STATUS "gcc flags are: " ${CMAKE_CXX_FLAGS})
40     #MESSAGE(STATUS "linker flags are: " ${CMAKE_SHARED_LINKER_FLAGS})
41   ENDIF(CMAKE_COMPILER_IS_GNUCC)
42 ENDIF(UNIX)