-
Notifications
You must be signed in to change notification settings - Fork 3
/
Findbsf.cmake
86 lines (70 loc) · 3.05 KB
/
Findbsf.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Find bsf dependency
#
# This module defines
# bsf_INCLUDE_DIRS
# bsf_LIBRARIES
# bsf_FOUND
message(STATUS "Looking for bsf installation...")
if(NOT bsf_INSTALL_DIR)
set(bsf_INSTALL_DIR ${PROJECT_SOURCE_DIR}/Dependencies/bsf CACHE PATH "")
endif()
set(bsf_INCLUDE_SEARCH_DIRS "${bsf_INSTALL_DIR}/include")
set(INCLUDE_FILES "bsfCore/BsCorePrerequisites.h")
find_path(bsf_INCLUDE_DIR NAMES NAMES ${INCLUDE_FILES} PATHS ${bsf_INCLUDE_SEARCH_DIRS} NO_DEFAULT_PATH)
find_path(bsf_INCLUDE_DIR NAMES NAMES ${INCLUDE_FILES} PATHS ${bsf_INCLUDE_SEARCH_DIRS})
if(bsf_INCLUDE_DIR)
set(bsf_FOUND TRUE)
else()
message(STATUS "...Cannot find include file \"${INCLUDE_FILES}\" at path ${bsf_INCLUDE_SEARCH_DIRS}")
set(bsf_FOUND FALSE)
endif()
# Add configuration specific search directories
list(APPEND bsf_LIBRARY_RELEASE_SEARCH_DIRS "${bsf_INSTALL_DIR}/lib/Release")
list(APPEND bsf_LIBRARY_DEBUG_SEARCH_DIRS "${bsf_INSTALL_DIR}/lib/Debug")
# Add search directories with no specified configuration
list(APPEND bsf_LIBRARY_RELEASE_SEARCH_DIRS "${bsf_INSTALL_DIR}/lib")
list(APPEND bsf_LIBRARY_DEBUG_SEARCH_DIRS "${bsf_INSTALL_DIR}/lib")
find_library(bsf_LIBRARY_RELEASE NAMES bsf PATHS ${bsf_LIBRARY_RELEASE_SEARCH_DIRS} NO_DEFAULT_PATH)
find_library(bsf_LIBRARY_RELEASE NAMES bsf PATHS ${bsf_LIBRARY_RELEASE_SEARCH_DIRS})
find_library(bsf_LIBRARY_DEBUG NAMES bsf PATHS ${bsf_LIBRARY_DEBUG_SEARCH_DIRS} NO_DEFAULT_PATH)
find_library(bsf_LIBRARY_DEBUG NAMES bsf PATHS ${bsf_LIBRARY_DEBUG_SEARCH_DIRS})
if(bsf_LIBRARY_RELEASE)
if(NOT WIN32)
add_library(bsf SHARED IMPORTED)
else()
add_library(bsf STATIC IMPORTED)
endif()
if(CMAKE_CONFIGURATION_TYPES) # Multiconfig generator?
set_target_properties(bsf PROPERTIES IMPORTED_LOCATION_RELEASE "${bsf_LIBRARY_RELEASE}")
set_target_properties(bsf PROPERTIES IMPORTED_LOCATION_RELWITHDEBINFO "${bsf_LIBRARY_RELEASE}")
set_target_properties(bsf PROPERTIES IMPORTED_LOCATION_MINSIZEREL "${bsf_LIBRARY_RELEASE}")
if(bsf_LIBRARY_DEBUG)
set_target_properties(bsf PROPERTIES IMPORTED_LOCATION_DEBUG "${bsf_LIBRARY_DEBUG}")
else()
set_target_properties(bsf PROPERTIES IMPORTED_LOCATION_DEBUG "${bsf_LIBRARY_RELEASE}")
endif()
else()
set_target_properties(bsf PROPERTIES IMPORTED_LOCATION "${bsf_LIBRARY_RELEASE}")
endif()
set(bsf_LIBRARIES bsf)
else()
set(bsf_FOUND FALSE)
endif()
mark_as_advanced(bsf_LIBRARY_RELEASE)
mark_as_advanced(bsf_LIBRARY_DEBUG)
if(NOT bsf_FOUND)
if(bsf_FIND_REQUIRED)
message(FATAL_ERROR "Cannot find bsf installation. Try modifying the bsf_INSTALL_DIR path.")
elseif(NOT bsf_FIND_QUIETLY)
message(WARNING "Cannot find bsf installation. Try modifying the bsf_INSTALL_DIR path.")
endif()
else()
list(APPEND INCLUDE_DIRS "${bsf_INCLUDE_DIR}/bsfUtility")
list(APPEND INCLUDE_DIRS "${bsf_INCLUDE_DIR}/bsfCore")
list(APPEND INCLUDE_DIRS "${bsf_INCLUDE_DIR}/bsfEngine")
set_target_properties(bsf PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${INCLUDE_DIRS}")
mark_as_advanced(bsf_INSTALL_DIR)
message(STATUS "...bsf OK.")
endif()
mark_as_advanced(bsf_INCLUDE_DIR)
set(bsf_INCLUDE_DIRS ${bsf_INCLUDE_DIR})