Commit 82cd60fc authored by Axel Loewe's avatar Axel Loewe
Browse files

Cmake compilation fix

parent 106995ca
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.12)
project(meshalyzer
VERSION 2.0
DESCRIPTION "Graphical program for display time dependent data on 3D finite elment meshes"
......
......@@ -14,6 +14,7 @@ endif(UNIX AND NOT APPLE)
find_package(Threads REQUIRED)
find_package(PNG REQUIRED)
find_package(JPEG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenGL REQUIRED)
find_package(OpenMP)
......@@ -29,6 +30,10 @@ execute_process(
OUTPUT_VARIABLE FLTK_LD_FLAGS
)
string(STRIP ${FLTK_LD_FLAGS} FLTK_LD_FLAGS)
# fltk-config does not provide lib path in linker command, use find_package
string(REPLACE "-lpng " "" FLTK_LD_FLAGS ${FLTK_LD_FLAGS})
string(REPLACE "-ljpeg " "" FLTK_LD_FLAGS ${FLTK_LD_FLAGS})
LIST(REMOVE_ITEM FLTK_LD_FLAGS "-lpng" )
message(STATUS "Found FLTK linking flags: ${FLTK_LD_FLAGS}")
# VTK
......@@ -42,13 +47,13 @@ if (USE_VTK)
)
find_package(VTK REQUIRED COMPONENTS ${MESHALYZER_VTK_COMPONENTS})
if (VTK_FOUND)
if (VTK_FOUND AND VTK_MAJOR_VERSION LESS 9)
message(STATUS "Found VTK components: ${VTK_LIBRARIES}")
message(STATUS "Found VTK includes: ${VTK_INCLUDE_DIRS}")
list(GET VTK_INCLUDE_DIRS 0 VTK_INCLUDE_DIRS_ONLY)
message(STATUS "Found VTK only includes: ${VTK_INCLUDE_DIRS_ONLY}")
endif (VTK_FOUND)
message(STATUS "Found VTK only includes: ${VTK_INCLUDE_DIRS_ONLY}")
elseif ()
message(STATUS "Found VTK components: ${VTK_LIBRARIES}")
endif ()
endif (USE_VTK)
# copy images to cmake build tree
......@@ -136,15 +141,16 @@ target_compile_definitions(meshalyzer PRIVATE
target_include_directories(meshalyzer PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${FLTK_INCLUDE_DIR}>
${FLTK_INCLUDE_DIR}
)
target_link_libraries(meshalyzer PRIVATE
${FLTK_LD_FLAGS}
Threads::Threads
PNG::PNG
JPEG::JPEG
ZLIB::ZLIB
OpenGL::GL
OpenGL::GL
)
if(GLUT_FOUND)
......@@ -161,8 +167,13 @@ endif(OpenMP_CXX_FOUND)
if(VTK_FOUND)
target_compile_definitions(meshalyzer PRIVATE USE_VTK)
target_include_directories(meshalyzer PRIVATE $<BUILD_INTERFACE:${VTK_INCLUDE_DIRS_ONLY}>)
target_link_libraries(meshalyzer PRIVATE ${VTK_LIBRARIES})
if(VTK_MAJOR_VERSION LESS 9)
target_include_directories(meshalyzer PRIVATE $<BUILD_INTERFACE:${VTK_INCLUDE_DIRS_ONLY}>)
target_link_libraries(meshalyzer PRIVATE ${VTK_LIBRARIES})
else()
vtk_module_autoinit(TARGETS meshalyzer MODULES VTK::CommonCore VTK::IOCore VTK::IOLegacy VTK::IOXML )
target_link_libraries(meshalyzer PRIVATE ${VTK_LIBRARIES})
endif()
endif(VTK_FOUND)
set_property(TARGET meshalyzer PROPERTY CXX_STANDARD 17)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment