FindCOINUTILS.cmake 3.38 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
2
3
4
5
6
# - Try to find COINUTILS
# Once done this will define
#  COINUTILS_FOUND - System has COINUTILS
#  COINUTILS_INCLUDE_DIRS - The COINUTILS include directories
#  COINUTILS_LIBRARIES - The libraries needed to use COINUTILS

Jan Möbius's avatar
Jan Möbius committed
7
8
9
10
11
12
13

# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
  # This is the base directory for windows library search used in the finders we shipp.
  set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
endif()

Jan Möbius's avatar
Jan Möbius committed
14
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
Jan Möbius's avatar
Jan Möbius committed
15
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
Jan Möbius's avatar
Jan Möbius committed
16
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
Jan Möbius's avatar
Jan Möbius committed
17
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
Jan Möbius's avatar
Jan Möbius committed
18
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
Jan Möbius's avatar
Jan Möbius committed
19
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
Jan Möbius's avatar
Jan Möbius committed
20
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
Jan Möbius's avatar
Jan Möbius committed
21
22
23
24
25
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*Win64" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/")
26
27
28
29
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*Win64" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x32/")
Jan Möbius's avatar
Jan Möbius committed
30
31
endif()

Jan Möbius's avatar
Jan Möbius committed
32
if ( NOT COINUTILS_FOUND )
David Bommes's avatar
David Bommes committed
33
34
35
36
37
38
39
40

find_path(COINUTILS_INCLUDE_DIR 
          NAMES CoinUtilsConfig.h
          PATHS "$ENV{COINUTILS_DIR}/include/coin"
                "$ENV{CBC_DIR}/include/coin"
                 "/usr/include/coin"
                 "C:\\libs\\coinutils\\include"
                 "C:\\libs\\cbc\\include"
Jan Möbius's avatar
Jan Möbius committed
41
42
                 "${VS_SEARCH_PATH}CBC-2.9.7/CoinUtils/include"
                 "${VS_SEARCH_PATH}CBC-2.9.4/CoinUtils/include"
David Bommes's avatar
David Bommes committed
43
44
          )

Jan Möbius's avatar
Jan Möbius committed
45
46
find_library( COINUTILS_LIBRARY_DEBUG
              NAMES CoinUtilsd libCoinUtilsd
David Bommes's avatar
David Bommes committed
47
48
49
50
51
              PATHS "$ENV{COINUTILS_DIR}/lib"
                    "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\coinutils\\lib"
Jan Möbius's avatar
Jan Möbius committed
52
                    "C:\\libs\\cbc\\lib"
Jan Möbius's avatar
Jan Möbius committed
53
                    "${VS_SEARCH_PATH}CBC-2.9.7/lib/${VS_SUBDIR}Debug"
Jan Möbius's avatar
Jan Möbius committed
54
                    "${VS_SEARCH_PATH}CBC-2.9.4/CoinUtils/lib"
David Bommes's avatar
David Bommes committed
55
              )
Jan Möbius's avatar
Jan Möbius committed
56
57
58
59
60
61
62
63
              
find_library( COINUTILS_LIBRARY_RELEASE
              NAMES CoinUtils libCoinUtils
              PATHS "$ENV{COINUTILS_DIR}/lib"
                    "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\coinutils\\lib"
Jan Möbius's avatar
Jan Möbius committed
64
                    "C:\\libs\\cbc\\lib"
Jan Möbius's avatar
Jan Möbius committed
65
                    "${VS_SEARCH_PATH}CBC-2.9.7/lib/${VS_SUBDIR}Release"
Jan Möbius's avatar
Jan Möbius committed
66
                    "${VS_SEARCH_PATH}CBC-2.9.4/CoinUtils/lib"
Jan Möbius's avatar
Jan Möbius committed
67
68
69
70
71
              )    
              
include(SelectLibraryConfigurations)
select_library_configurations( COINUTILS )

David Bommes's avatar
David Bommes committed
72
73
74
75
76
77
78
79
80
81
82
83
84

set(COINUTILS_INCLUDE_DIRS "${COINUTILS_INCLUDE_DIR}" )
set(COINUTILS_LIBRARIES "${COINUTILS_LIBRARY}" )


include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set COINUTILS_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(COINUTILS  DEFAULT_MSG
                                  COINUTILS_LIBRARY COINUTILS_INCLUDE_DIR)

mark_as_advanced(COINUTILS_INCLUDE_DIR COINUTILS_LIBRARY)

Jan Möbius's avatar
Jan Möbius committed
85
endif(NOT COINUTILS_FOUND)