1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00
occt/samples/mfc/standard/mfcsample/CMakeLists.txt
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

194 lines
9.6 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 (mfcsample)
add_definitions(-DWINVER=0x0501 -D_AFXEXT -DUNICODE -D_UNICODE)
if (NOT BUILD_SHARED_LIBS AND WIN32)
add_definitions ("-DOCCT_STATIC_BUILD")
endif()
set (CMAKE_MFC_FLAG 2)
# mfcsample
set (mfcsample_SOURCE_FILES ${MFC_STANDARD_SAMPLES_DIR}/mfcsample/src/mfcsample.cpp
${MFC_STANDARD_SAMPLES_DIR}/mfcsample/src/StdAfx.cpp )
SET (MFC_STANDARD_COMMON_SAMPLES_DIR "${MFC_STANDARD_SAMPLES_DIR}/Common")
set (COMMON_SOURCE_FILES ${MFC_STANDARD_COMMON_SAMPLES_DIR}/AISDialogs.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dDoc.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dChildFrame.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dView.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dBaseDoc.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_App.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dDoc.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dChildFrame.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dView.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseDoc.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseChildFrame.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseView.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_MainFrame.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_StereoConfigDlg.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ParamsFacesPage.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ResultDialog.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ColoredMeshDlg.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/DimensionDlg.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgePage.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/RadiusParamsPage.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgesPage.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.cpp
${MFC_STANDARD_COMMON_SAMPLES_DIR}/AngleParamsVerticesPage.cpp)
# Common ImportExport
set (COMMON_IE_DIR ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ImportExport)
set (COMMON_IE_HEADER_FILES ${COMMON_IE_DIR}/ImportExport.h
${COMMON_IE_DIR}/SaveSTEPDlg.h )
set (COMMON_IE_SOURCE_FILES ${COMMON_IE_DIR}/ImportExport.cpp
${COMMON_IE_DIR}/SaveSTEPDlg.cpp )
# Common ISession2D
set (COMMON_ISESSION2D_DIR ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ISession2D)
set (COMMON_ISESSION2D_HEADER_FILES ${COMMON_ISESSION2D_DIR}/ISession2D_Shape.h )
set (COMMON_ISESSION2D_SOURCE_FILES ${COMMON_ISESSION2D_DIR}/ISession2D_Shape.cpp )
# Common Resource2D
set (COMMON_RESOURCE2D_DIR ${MFC_STANDARD_COMMON_SAMPLES_DIR}/Resource2D)
set (COMMON_RESOURCE2D_HEADER_FILES ${COMMON_RESOURCE2D_DIR}/CircularGrid.h
${COMMON_RESOURCE2D_DIR}/RectangularGrid.h )
set (COMMON_RESOURCE2D_SOURCE_FILES ${COMMON_RESOURCE2D_DIR}/CircularGrid.cpp
${COMMON_RESOURCE2D_DIR}/RectangularGrid.cpp )
# Common headers
set (COMMON_HEADER_FILES ${MFC_STANDARD_COMMON_SAMPLES_DIR}/AISDialogs.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dDoc.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dChildFrame.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dView.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dBaseDoc.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_App.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dDoc.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dChildFrame.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dView.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseDoc.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseChildFrame.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseView.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_MainFrame.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_StereoConfigDlg.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ParamsFacesPage.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ResultDialog.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/User_Cylinder.hxx
${MFC_STANDARD_COMMON_SAMPLES_DIR}/ColoredMeshDlg.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/DimensionDlg.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgePage.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/RadiusParamsPage.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgesPage.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.h
${MFC_STANDARD_COMMON_SAMPLES_DIR}/AngleParamsVerticesPage.h)
# Common resources
set (COMMON_RESOURCE_DIR ${MFC_STANDARD_COMMON_SAMPLES_DIR}/res)
set (COMMON_RESOURCE_FILES ${COMMON_RESOURCE_DIR}/2dChildFrameTB.bmp
${COMMON_RESOURCE_DIR}/2dType.ico
${COMMON_RESOURCE_DIR}/3dChildFrameTB.bmp
${COMMON_RESOURCE_DIR}/3dType.ico
${COMMON_RESOURCE_DIR}/AIS_TB.bmp
${COMMON_RESOURCE_DIR}/coloredm.bmp
${COMMON_RESOURCE_DIR}/MainFrame.ico
${COMMON_RESOURCE_DIR}/occ_logo.bmp
${COMMON_RESOURCE_DIR}/OCC_Resource.rc)
# groups in the VS solution
source_group ( "Header Files" FILES ${COMMON_HEADER_FILES}
${COMMON_IE_HEADER_FILES}
${COMMON_RESOURCE2D_HEADER_FILES}
${COMMON_ISESSION2D_HEADER_FILES})
source_group ("Source Files" FILES ${mfcsample_SOURCE_FILES}
${COMMON_SOURCE_FILES}
${COMMON_IE_SOURCE_FILES}
${COMMON_RESOURCE2D_SOURCE_FILES}
${COMMON_ISESSION2D_SOURCE_FILES})
source_group ( "Resource Files" FILES ${COMMON_RESOURCE_FILES})
# mfcsample library
add_library ( mfcsample ${mfcsample_SOURCE_FILES}
${COMMON_HEADER_FILES}
${COMMON_SOURCE_FILES}
${COMMON_IE_HEADER_FILES}
${COMMON_IE_SOURCE_FILES}
${COMMON_RESOURCE2D_HEADER_FILES}
${COMMON_RESOURCE2D_SOURCE_FILES}
${COMMON_ISESSION2D_HEADER_FILES}
${COMMON_ISESSION2D_SOURCE_FILES}
${COMMON_RESOURCE_FILES})
set_property (TARGET mfcsample PROPERTY FOLDER "Samples/mfc")
if (SINGLE_GENERATOR)
install (TARGETS mfcsample
RUNTIME DESTINATION "${INSTALL_DIR_BIN}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}")
else()
install (TARGETS mfcsample
CONFIGURATIONS Release RelWithDebInfo
RUNTIME DESTINATION "${INSTALL_DIR_BIN}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}")
install (TARGETS mfcsample
CONFIGURATIONS Debug
RUNTIME DESTINATION "${INSTALL_DIR_BIN}d"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}d"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}d")
endif()
include_directories( ${CMAKE_BINARY_DIR}/inc
${MFC_STANDARD_COMMON_SAMPLES_DIR}
${COMMON_IE_DIR}
${COMMON_ISESSION2D_DIR}
${COMMON_RESOURCE2D_DIR})
# OCCT libraries for using
set (mfcsample_USED_LIBS TKVRML
TKSTL
TKBRep
TKIGES
TKShHealing
TKSTEP
TKSTEPBase
TKSTEP209
TKSTEPAttr
TKXSBase
TKBool
TKBO
TKCAF
TKCDF
TKernel
TKFeat
TKFillet
TKG2d
TKG3d
TKGeomAlgo
TKGeomBase
TKHLR
TKMath
TKOffset
TKOpenGl
TKPrim
TKService
TKTopAlgo
TKMesh
TKV3d
${CSF_OpenGlLibs})
target_link_libraries (mfcsample ${mfcsample_USED_LIBS})