mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
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.
69 lines
1.4 KiB
CMake
69 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.2)
|
|
|
|
project(glfw-occt-demo)
|
|
|
|
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
|
|
|
|
set(APP_VERSION_MAJOR 1)
|
|
set(APP_VERSION_MINOR 0)
|
|
set(APP_TARGET glfwocct)
|
|
|
|
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
|
file(GLOB SOURCES
|
|
*.h
|
|
*.cpp
|
|
)
|
|
source_group ("Headers" FILES
|
|
GlfwOcctView.h
|
|
GlfwOcctWindow.h)
|
|
source_group ("Sources" FILES
|
|
GlfwOcctView.cpp
|
|
GlfwOcctWindow.cpp
|
|
main.cpp)
|
|
|
|
# OpenGL
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
# Open CASCADE Technology
|
|
find_package (OpenCASCADE REQUIRED)
|
|
if (NOT OpenCASCADE_FOUND)
|
|
message (FATAL_ERROR "coult not find OpenCASCADE, please set OpenCASCADE_DIR variable" )
|
|
else()
|
|
message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_INSTALL_PREFIX}\"" )
|
|
message (STATUS "OpenCASCADE_INCLUDE_DIR=${OpenCASCADE_INCLUDE_DIR}")
|
|
message (STATUS "OpenCASCADE_LIBRARY_DIR=${OpenCASCADE_LIBRARY_DIR}")
|
|
INCLUDE_DIRECTORIES(${OpenCASCADE_INCLUDE_DIR})
|
|
endif()
|
|
|
|
SET(OpenCASCADE_LIBS
|
|
TKernel
|
|
TKService
|
|
TKV3d
|
|
TKOpenGl
|
|
TKBRep
|
|
TKGeomBase
|
|
TKGeomAlgo
|
|
TKG3d
|
|
TKG2d
|
|
TKTopAlgo
|
|
TKPrim
|
|
)
|
|
|
|
# glfw
|
|
find_package(glfw3 REQUIRED)
|
|
if (glfw3_FOUND)
|
|
message (STATUS "Using glfw3 ${glfw3_VERSION}" )
|
|
INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIRS})
|
|
LINK_DIRECTORIES(${GLFW_LIBRARY_DIRS})
|
|
else()
|
|
message (STATUS "glfw3 is not found." )
|
|
endif()
|
|
|
|
add_executable(${APP_TARGET} ${SOURCES})
|
|
target_link_libraries(
|
|
${APP_TARGET}
|
|
${OpenCASCADE_LIBS}
|
|
glfw
|
|
${OPENGL_LIBRARIES}
|
|
)
|