Skip to content

Commit 32159e2

Browse files
nbogdanmsv
authored andcommitted
Make possibility to exclude the class rvmmeshhelper from the library to get rid of dependence on OpenGl.
For that the cmake Boolean option USE_MESH_HELPER has been added.
1 parent 858e625 commit 32159e2

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

cmake-lib/CMakeLists.txt

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,40 @@ if(UNIX)
66
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")
77
endif()
88

9-
# Add OpenGL dependencies
10-
set (OpenGL_GL_PREFERENCE LEGACY)
11-
find_package(OpenGL REQUIRED)
12-
13-
add_library(${PROJECT_NAME} SHARED
14-
../src/api/rvmcolorhelper.cpp
15-
../src/api/rvmmeshhelper.cpp
16-
../src/api/rvmparser.cpp
17-
../src/api/rvmreader.cpp
18-
../src/api/vector3f.cpp
9+
set (SRC_LIST
10+
../src/api/rvmcolorhelper.cpp
11+
../src/api/rvmparser.cpp
12+
../src/api/rvmreader.cpp
13+
../src/api/vector3f.cpp
1914
)
2015

21-
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "../src/api/lib_export.h;../src/api/rvmcolorhelper.h;../src/api/rvmmeshhelper.h;../src/api/rvmparser.h;../src/api/rvmprimitive.h;../src/api/rvmreader.h;../src/api/vector3f.h"
16+
set (HEADER_LIST
17+
../src/api/lib_export.h
18+
../src/api/rvmcolorhelper.h
19+
../src/api/rvmparser.h
20+
../src/api/rvmprimitive.h
21+
../src/api/rvmreader.h
22+
../src/api/vector3f.h
2223
)
2324

25+
set (USE_MESH_HELPER TRUE CACHE BOOL
26+
"Indicates whether it is needed to include rvmmeshhelper class in the library")
27+
28+
if (USE_MESH_HELPER)
29+
# Add OpenGL dependencies
30+
set (OpenGL_GL_PREFERENCE LEGACY)
31+
find_package (OpenGL REQUIRED)
32+
33+
list (APPEND SRC_LIST ../src/api/rvmmeshhelper.cpp)
34+
list (APPEND HEADER_LIST ../src/api/rvmmeshhelper.h)
35+
36+
endif()
37+
38+
add_library (${PROJECT_NAME} SHARED "${SRC_LIST}")
39+
40+
set_target_properties (${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADER_LIST}")
41+
42+
2443
install(TARGETS ${PROJECT_NAME}
2544
CONFIGURATIONS Release
2645
RUNTIME DESTINATION bin

0 commit comments

Comments
 (0)