Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

Commit

Permalink
chore(cmake): remove find_library wrappers
Browse files Browse the repository at this point in the history
they were needed in the age before conan.
  • Loading branch information
a-teammate committed Feb 15, 2018
1 parent 992e212 commit f47f05a
Showing 1 changed file with 0 additions and 96 deletions.
96 changes: 0 additions & 96 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,102 +105,6 @@ function(prepend variable prep)
set(${variable} ${res} PARENT_SCOPE)
endfunction()

# Wrapper around find_library to autodetect debug and
# release versions of a library.
#
# This is necessary when building on Windows in VS (ABI conflicts between MT and MTd).
#
# Note: only effects msvc so far
# Usage: find_cpp_library(<RETURNVAR> <LIBNAME> [NOCACHE])
# Arguments:
# VAR – Output variable
# LIB - the Library name
# Example: find_cpp_library(PROTOBUF_LIBRARIES protobuf)
#
function(find_cpp_library VAR LIB)
if(DEFINED HAS_FIND_LIBRARY_WRAPPER)
definition_find_cpp_library(tmp ${LIB})
if(NOT tmp)
find_library(tmp ${LIB})
endif()
else()
find_library(tmp ${LIB})
endif()

if (ARGN STREQUAL "NOCACHE")
set(${VAR} "${tmp}" PARENT_SCOPE)
else()
set(${VAR} "${tmp}" CACHE INTERNAL "")
endif()

unset(tmp CACHE)
endfunction()

# Search for multiple libraries with multiple possible names
#
# This is be useful, when a module requires multiple libs or
# when a lib can have multiple names.
#
# Wrapper around find_cpp_library, so libs with debug and
# release versions are supported, which in turn is a wrapper
# around find library, so you can omit /^lib/ and the usual
# suffixes (.dll/.so/.o/.obj/.a)
#
# USAGE: find_libs(<OUTVAR> lib1_names...
# [LIB libN_names... ]... NOCACHE)
#
# EXAMPLE:
# You are working on module `cuteness` module cuteness;
# cuteness depends on two libraries: libkittens.so and
# libdog.a; libdog.a might however also be called libpuppy.so.
# You could use the following command:
#
# find_libs(CUTENESS_LIBS kittens LIB dog puppy)
function(find_libs)
set(out "")
set(found "")
set(outvar "")
set(nocache "")
set(attempts "")

## READING ARGS

foreach(arg ${ARGN})

if(${arg} STREQUAL "NOCACHE")
set(nocache true)

elseif(${arg} STREQUAL "LIB")
if (NOT found AND NOT attempts STREQUAL "")
message(SEND_ERROR "Could not find a lib for ${attempts} !")
endif()
set(found "")
set(attempts "")

elseif(NOT outvar) # First real arg: OUTVAR
set(outvar "${arg}")

elseif(NOT found) # Real arg: lib name
find_cpp_library(lib "${arg}" NOCACHE)
if (lib)
set(found true)
list(APPEND out "${lib}")
else()
list(APPEND attempts "${arg}")
endif()

endif()
endforeach()

## RETURN

if (out AND nocache)
set(${outvar} ${out} PARENT_SCOPE)
elseif(out)
set(${outvar} ${out} CACHE INTERNAL "")
endif()
endfunction()

function(add_windows_manifest target)
add_custom_command(
TARGET ${target}
Expand Down

0 comments on commit f47f05a

Please sign in to comment.