-
Notifications
You must be signed in to change notification settings - Fork 2
/
PowerfulGAConfig.cmake
72 lines (49 loc) · 1.97 KB
/
PowerfulGAConfig.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
# Defines the following variables:
#
# PowerfulGA_static_library <- contains the path to the static library.
# PowerfulGA_include_directories <- contains a list of directories which you should include in order to use PowerfulGA.
set(actual_GA_dir "")
set(GA_dir_provided OFF)
set(possible_GA_dir_names
PowerfulGA_DIR
GA_DIR
PowerfulGA_Dir
GA_Dir
PowerfulGA_dir
GA_dir
powerfulGA_dir
ga_dir
)
foreach(current_dir_name_variation ${possible_GA_dir_names})
if (EXISTS ${${current_dir_name_variation}})
set(GA_dir_provided ON)
set(actual_GA_dir ${${current_dir_name_variation}})
endif()
endforeach()
if(NOT ${GA_dir_provided})
message(FATAL_ERROR "You didn`t provide a directory variable with any of supported names (${possible_GA_dir_names}) or the direcory you provided as pythonic_dir doesn`t actually exist!")
endif()
set(GA_release_build_dir ${actual_GA_dir}/cmake-build-release)
set(GA_debug_build_dir ${actual_GA_dir}/cmake-build-debug)
if (${CMAKE_BUILD_TYPE} STREQUAL Release)
set(GA_build_dir ${GA_release_build_dir})
elseif(${CMAKE_BUILD_TYPE} STREQUAL Debug) # It`s Debug!
set(GA_build_dir ${GA_debug_build_dir})
else()
message(FATAL_ERROR "Bad CMAKE_BUILD_TYPE (${CMAKE_BUILD_TYPE}). It should be either Release or Debug")
endif()
# Choose static library name based on operation system:
if(UNIX)
set(PGA_static_library_name libGA.a)
endif()
if(WIN32)
set(PGA_static_library_name GA.lib)
endif()
set(deducted_PGA_lib_location "${GA_build_dir}/${PGA_static_library_name}")
if (EXISTS ${deducted_PGA_lib_location})
set(PowerfulGA_static_libraries ${deducted_PGA_lib_location})
message(STATUS "Found PowerfulGA static library here: ${PowerfulGA_static_libraries}")
else()
message(FATAL_ERROR "Can`t find PowerfulGA static library file in corresponding directory!!! (${deducted_PGA_lib_location})")
endif()
set(PowerfulGA_include_directories ${actual_GA_dir})