0032613: Samples - glfw compilation error on Linux
[occt.git] / samples / glfw / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.2)
2
3 project(glfw-occt-demo)
4
5 set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
6
7 set(CMAKE_CXX_STANDARD 11)
8 set(APP_VERSION_MAJOR 1)
9 set(APP_VERSION_MINOR 0)
10 set(APP_TARGET glfwocct)
11
12 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
13 file(GLOB SOURCES
14   *.h
15   *.cpp
16 )
17 source_group ("Headers" FILES
18   GlfwOcctView.h
19   GlfwOcctWindow.h)
20 source_group ("Sources" FILES
21   GlfwOcctView.cpp
22   GlfwOcctWindow.cpp
23   main.cpp)
24
25 # OpenGL
26 find_package(OpenGL REQUIRED)
27
28 # Open CASCADE Technology
29 find_package (OpenCASCADE REQUIRED)
30 if (NOT OpenCASCADE_FOUND)
31   message (FATAL_ERROR "coult not find OpenCASCADE, please set OpenCASCADE_DIR variable" )
32 else()
33   message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_INSTALL_PREFIX}\"" )
34   message (STATUS "OpenCASCADE_INCLUDE_DIR=${OpenCASCADE_INCLUDE_DIR}")
35   message (STATUS "OpenCASCADE_LIBRARY_DIR=${OpenCASCADE_LIBRARY_DIR}")
36   INCLUDE_DIRECTORIES(${OpenCASCADE_INCLUDE_DIR})
37 endif()
38
39 SET(OpenCASCADE_LIBS 
40   TKernel
41   TKService
42   TKV3d
43   TKOpenGl
44   TKBRep
45   TKGeomBase
46   TKGeomAlgo
47   TKG3d
48   TKG2d
49   TKTopAlgo
50   TKPrim
51 )
52
53 # glfw
54 find_package(glfw3 REQUIRED)
55 if (glfw3_FOUND)
56   message (STATUS "Using glfw3 ${glfw3_VERSION}" )
57   INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIRS})
58   LINK_DIRECTORIES(${GLFW_LIBRARY_DIRS})
59 else()
60   message (STATUS "glfw3 is not found." )
61 endif()
62
63 add_executable(${APP_TARGET} ${SOURCES})
64 target_link_libraries(
65   ${APP_TARGET}
66   ${OpenCASCADE_LIBS}
67   glfw
68   ${OPENGL_LIBRARIES}
69 )