1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00
ddzama e92d322d40 0032921: Configuration, CMake - allow selecting C++ standard.
Make C++ standard to be enable from cmake settings:

User will be able choosing C++ language standard by selecting cmake variable BUILD_CPP_STANDARD.
For correct working, CMAKE_CXX_STANDARD cmake built-in variable should be available.
To enable CMAKE_CXX_STANDARD, minimum CMAKE version has been updated to 3.1.

Available next standard items:
C++11
C++14
C++17
C++20
C++23

This issue consists from several steps to achive main goal:
1) Configuratiuon, CMake - allow selecting C++ standard.
2) Require minimum CMAKE version 3.1 (for enabling CMAKE_CXX_STANDARD).
3) More flexible CMAKE_CXX_COMPILER_ID identification (fixups previous commit!)
4) Add description of new CMAKE variable `BUILD_CPP_STANDARD` into documentation.
5) Update CMAKE requirements in documentation.
6) Set C++11 standard for several projects.
2022-09-06 20:06:54 +03:00

93 lines
4.5 KiB
CMake

# Caution! Be careful, when increase minimal cmake version:
# using of newer version may leads (by default) to applying
# of some new policies. It may break compilation.
# For canceling of applying new policies use:
# cmake_policy(PUSH) before `cmake_minimum_required`
# and cmake_policy(POP) after.
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
project (Geometry)
add_definitions(-DWINVER=0x0501 -DUNICODE -D_UNICODE)
set (CMAKE_MFC_FLAG 2)
set (Geometry_SRC_DIR ${MFC_STANDARD_SAMPLES_DIR}/01_Geometry/src)
set (Geometry_HEADER_FILES ${Geometry_SRC_DIR}/ChildFrm.h
${Geometry_SRC_DIR}/ChildFrm2d.h
${Geometry_SRC_DIR}/GeoAlgo_Sol.hxx
${Geometry_SRC_DIR}/GeometryApp.h
${Geometry_SRC_DIR}/GeometryDoc.h
${Geometry_SRC_DIR}/GeometryView.h
${Geometry_SRC_DIR}/GeometryView2D.h
${Geometry_SRC_DIR}/GeomSources.h
${Geometry_SRC_DIR}/MainFrm.h
${Geometry_SRC_DIR}/StdAfx.h )
set (Geometry_SOURCE_FILES ${Geometry_SRC_DIR}/ChildFrm.cpp
${Geometry_SRC_DIR}/ChildFrm2d.cpp
${Geometry_SRC_DIR}/GeoAlgo_Sol.cxx
${Geometry_SRC_DIR}/GeometryApp.cpp
${Geometry_SRC_DIR}/GeometryDoc.cpp
${Geometry_SRC_DIR}/GeometryView.cpp
${Geometry_SRC_DIR}/GeometryView2D.cpp
${Geometry_SRC_DIR}/GeomSources.cpp
${Geometry_SRC_DIR}/MainFrm.cpp
${Geometry_SRC_DIR}/StdAfx.cpp )
set (Geometry_ISESSION2D_DIR ${Geometry_SRC_DIR}/ISession2D)
set (Geometry_ISESSION2D_HEADER_FILES ${Geometry_ISESSION2D_DIR}/ISession_Curve.h
${Geometry_ISESSION2D_DIR}/ISession_Direction.h
${Geometry_ISESSION2D_DIR}/ISession_Point.h
${Geometry_ISESSION2D_DIR}/ISession_Surface.h
${Geometry_ISESSION2D_DIR}/ISession2D_Curve.h)
set (Geometry_ISESSION2D_SOURCE_FILES ${Geometry_ISESSION2D_DIR}/ISession_Curve.cpp
${Geometry_ISESSION2D_DIR}/ISession_Direction.cpp
${Geometry_ISESSION2D_DIR}/ISession_Point.cpp
${Geometry_ISESSION2D_DIR}/ISession_Surface.cpp
${Geometry_ISESSION2D_DIR}/ISession2D_Curve.cpp)
set (Geometry_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/01_Geometry/res)
set (Geometry_RESOURCE_HEADER ${Geometry_RESOURCE_DIR}/resource.h)
set (Geometry_RESOURCE_FILES ${Geometry_RESOURCE_DIR}/Geometry.rc
${Geometry_RESOURCE_DIR}/Toolbar1.bmp
${Geometry_RESOURCE_DIR}/Toolbar2.bmp)
# groups in the VS solution
source_group ("Source Files" FILES ${Geometry_SOURCE_FILES}
${COMMON_WINMAIN_FILE})
source_group ("Source Files\\ISession2d" FILES ${Geometry_ISESSION2D_SOURCE_FILES})
source_group ("Header Files" FILES ${Geometry_HEADER_FILES}
${Geometry_ISESSION2D_HEADER_FILES}
${Geometry_RESOURCE_HEADER})
source_group ("Resource Files" FILES ${Geometry_RESOURCE_FILES})
add_executable (Geometry WIN32 ${Geometry_SOURCE_FILES}
${Geometry_HEADER_FILES}
${COMMON_WINMAIN_FILE}
${Geometry_ISESSION2D_SOURCE_FILES}
${Geometry_ISESSION2D_HEADER_FILES}
${Geometry_RESOURCE_FILES}
${Geometry_RESOURCE_HEADER})
set_property(TARGET Geometry PROPERTY FOLDER "Samples/mfc")
if (SINGLE_GENERATOR)
install (TARGETS Geometry DESTINATION "${INSTALL_DIR_BIN}")
else()
install (TARGETS Geometry
CONFIGURATIONS Release RelWithDebInfo
DESTINATION "${INSTALL_DIR_BIN}")
install (TARGETS Geometry
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_BIN}d")
endif()
include_directories (${CMAKE_BINARY_DIR}/inc
${Geometry_SRC_DIR}
${Geometry_ISESSION2D_DIR}
${Geometry_RESOURCE_DIR}
${MFC_STANDARD_SAMPLES_DIR}/Common)
target_link_libraries (Geometry mfcsample)