FindAlglib.cmake 1.01 KB
Newer Older
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
#sudo apt install libalglib-dev

set(Alglib_FOUND FALSE)

find_path(Alglib_INCLUDE_DIR libalglib/solvers.h
	PATHS /usr/local/include /usr/include
	PATH_SUFFIXES libalglib ENV PATH)


find_library(Alglib_LIBRARY NAMES alglib)


if(Alglib_INCLUDE_DIR AND Alglib_LIBRARY)

	mark_as_advanced(Alglib_INCLUDE_DIR)
	mark_as_advanced(Alglib_LIBRARY)

	message(STATUS "~~~~~~~~~~~~~ ${_LIBRARY} ~~~~~~~~~~~~~~~")

	set(Alglib_FOUND TRUE)

endif()


if(Alglib_FOUND)


    set(Alglib_INCLUDE_DIRS ${Alglib_INCLUDE_DIR})
    set(Alglib_LIBRARIES ${Alglib_LIBRARY})
    if(NOT TARGET Alglib::Alglib)
        add_library(Alglib::Alglib UNKNOWN IMPORTED)
        set_target_properties(Alglib::Alglib PROPERTIES
            IMPORTED_LOCATION             "${Alglib_LIBRARY}"
            INTERFACE_INCLUDE_DIRECTORIES "${Alglib_INCLUDE_DIR}")
    endif()

else()

	if(Alglib_FIND_REQUIRED)

		message(FATAL_ERROR "Could not find Alglib_LIBRARY. Please do specify the
		Alglib_INCLUDE_DIRS and Alglib_LIBRARIES variables using cmake!")

	endif()

endif()