Skip to content

Commit

Permalink
Configuration, CMake - use include() instead of find_package() for th…
Browse files Browse the repository at this point in the history
…ird-parties

to distinguish normal configuration files from custom search scripts.
  • Loading branch information
gkv311 committed Dec 23, 2024
1 parent bd0e863 commit 5537537
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ cmake_minimum_required (VERSION 3.7)
# common solution for multiple independent projects
project (sView)

set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
# we use include(adm/cmake/Find*.cmake) explicitly instead of find_package()
# to distinguish normal configuration files from custom search scripts
#set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})

set (APP_VERSION_MAJOR 1)
set (APP_VERSION_MINOR 0)

Expand Down Expand Up @@ -109,23 +112,23 @@ if (USE_UPDATER)
add_definitions(-DST_UPDATES_CHECK)
endif()

find_package (freetype REQUIRED)
include (adm/cmake/FindFreetype.cmake)
if (NOT FREETYPE_FOUND)
message (FATAL_ERROR "could not find FreeType, please set FREETYPE_DIR variable" )
else()
message (STATUS "FREETYPE_INCLUDE_DIR=${FREETYPE_INCLUDE_DIR}")
message (STATUS "FREETYPE_LIBRARY_DIR=${FREETYPE_LIBRARY_DIR}")
endif()

find_package (FFmpeg REQUIRED)
include (adm/cmake/FindFFmpeg.cmake)
if (NOT FFMPEG_FOUND)
message (FATAL_ERROR "could not find FFmpeg, please set FFMPEG_DIR variable" )
else()
message (STATUS "FFMPEG_INCLUDE_DIR=${FFMPEG_INCLUDE_DIR}")
message (STATUS "FFMPEG_LIBRARY_DIR=${FFMPEG_LIBRARY_DIR}")
endif()

find_package (OpenAL REQUIRED)
include (adm/cmake/FindOpenAL.cmake)
if (NOT OPENAL_FOUND)
message (FATAL_ERROR "could not find OpenAL, please set OPENAL_DIR variable" )
else()
Expand All @@ -135,7 +138,7 @@ endif()

if (USE_OPENVR)
add_definitions(-DST_HAVE_OPENVR)
find_package (OpenVR REQUIRED)
include (adm/cmake/FindOpenVR.cmake)
if (NOT OPENVR_FOUND)
message (FATAL_ERROR "could not find OpenVR, please set OPENVR_DIR variable" )
else()
Expand All @@ -146,7 +149,7 @@ endif()

if (WIN32)
if (USE_FREEIMAGE)
find_package (FreeImage REQUIRED)
include (adm/cmake/FindFreeImage.cmake)
if (NOT FREEIMAGE_FOUND)
message (FATAL_ERROR "could not find FreeImage, please set FREEIMAGE_DIR variable" )
else()
Expand All @@ -155,15 +158,15 @@ if (WIN32)
endif()

if (USE_DEVIL)
find_package (DevIL REQUIRED)
include (adm/cmake/FindDevIL.cmake)
if (NOT DEVIL_FOUND)
message (FATAL_ERROR "could not find DevIL, please set DEVIL_DIR variable" )
else()
message (STATUS "DEVIL_BINARY_DIR=${DEVIL_BINARY_DIR}")
endif()
endif()

find_package (NVAPI REQUIRED)
include (adm/cmake/FindNVAPI.cmake)
if (NOT NVAPI_FOUND)
message (FATAL_ERROR "could not find NVAPI, please set NVAPI_DIR variable" )
else()
Expand All @@ -172,7 +175,7 @@ if (WIN32)
endif()

if (USE_MSVCR)
find_package (MSVCR REQUIRED)
include (adm/cmake/FindMSVCR.cmake)
if (NOT MSVCR_FOUND)
message (FATAL_ERROR "could not find MSVCR, please set MSCVR_DIR variable" )
else()
Expand Down Expand Up @@ -298,7 +301,7 @@ add_subdirectory(sview)

# CAD Viewer
# find Open CASCADE Technology
#find_package (OpenCASCADE REQUIRED)
#include (adm/cmake/FindOpenCASCADE.cmake)
#if (NOT OpenCASCADE_FOUND)
# message (FATAL_ERROR "could not find OpenCASCADE, please set OpenCASCADE_DIR variable" )
#else()
Expand Down

0 comments on commit 5537537

Please sign in to comment.