cmake: CheckLib allow to search only include

Some libraries doesn't have any .so file
This commit is contained in:
Gregory Hainaut 2015-05-11 11:28:09 +02:00
parent 30e3956ea7
commit 797e3d81da
1 changed files with 21 additions and 11 deletions

View File

@ -17,7 +17,7 @@ macro(check_lib var lib)
# Make sure include directories for headers found using find_path below # Make sure include directories for headers found using find_path below
# are re-added when reconfiguring # are re-added when reconfiguring
include_directories(${${var}_INCLUDE}) include_directories(${${var}_INCLUDE})
_internal_message("-- ${lib} found") _internal_message("-- ${var} found")
else() else()
find_library(${var}_LIBRARIES ${lib}) find_library(${var}_LIBRARIES ${lib})
if(_arg_list) if(_arg_list)
@ -25,16 +25,26 @@ macro(check_lib var lib)
else() else()
set(${var}_INCLUDE FALSE) set(${var}_INCLUDE FALSE)
endif() endif()
if(${var}_LIBRARIES AND ${var}_INCLUDE) if (${lib})
include_directories(${${var}_INCLUDE}) if(${var}_LIBRARIES AND ${var}_INCLUDE)
_internal_message("-- ${lib} found") include_directories(${${var}_INCLUDE})
set(${var}_FOUND 1 CACHE INTERNAL "") _internal_message("-- ${var} found")
elseif(${var}_LIBRARIES) set(${var}_FOUND 1 CACHE INTERNAL "")
_internal_message("-- ${lib} not found (miss include)") elseif(${var}_LIBRARIES)
elseif(${var}_INCLUDE) _internal_message("-- ${var} not found (miss include)")
_internal_message("-- ${lib} not found (miss lib)") elseif(${var}_INCLUDE)
_internal_message("-- ${var} not found (miss lib)")
else()
_internal_message("-- ${var} not found")
endif()
else() else()
_internal_message("-- ${lib} not found") if(${var}_INCLUDE)
endif() include_directories(${${var}_INCLUDE})
_internal_message("-- ${var} found")
set(${var}_FOUND 1 CACHE INTERNAL "")
else()
_internal_message("-- ${var} not found")
endif()
endif()
endif() endif()
endmacro() endmacro()