Skip to content
Snippets Groups Projects
Commit e4673e8d authored by Martin Beseda's avatar Martin Beseda
Browse files

Testing own FindBoost.cmake

parent 8314062e
No related branches found
No related tags found
No related merge requests found
# This file is NOT an original FindBoost.cmake module provided by KitWare!
#
# It's a simplified version whose only purpose is to be used in a software
# library lib4neuro and it does NOT provide a full funcionality of the original.
# library lib4neuro and it does NOT provide a full funcionality of the original,
# as it only works with the system-layout-named libraries (e.g. libboost_system.so).
# Optional user-defined variables
# (can be passed directly to CMake or exported as environmental variables
......@@ -27,6 +28,8 @@ message("FindBoost starting...")
# Check if needed Boost components were specified
if(NOT Boost_FIND_COMPONENTS)
message(FATAL_ERROR "No Boost components were specified! Please, set them correctly with flag COMPONENTS (see Module Usage section in this script).")
else()
message("Required Boost components: ${Boost_FIND_COMPONENTS}")
endif()
# Look for a standard boost header file.
......@@ -61,9 +64,11 @@ if(NOT DEPENDENCIES_LINK_TYPE)
message(FATAL_ERROR "Variable DEPENDENCIES_LINK_TYPE is not set! Set it to 'static' or 'shared'.")
endif()
set(LIB_SUFFIX "a")
set(LIB_SUFFIX "a") # suffix for Linux static libraries
if("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared" AND WIN32)
set(LIB_SUFFIX "dll")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "static" AND WIN32)
se(LIB_SUFFIX "lib")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared")
set(LIB_SUFFIX "so")
endif()
......@@ -104,6 +109,8 @@ find_path(
# targets, so they may be linked
set(Boost_LIBRARIES "")
foreach(LIBNAME ${REQUESTED_BOOST_LIBS})
message("Looking for ${LIBNAME}...")
set(${LIBNAME} "${LIBNAME}-NOTFOUND")
find_library(
${LIBNAME}
......@@ -121,6 +128,12 @@ foreach(LIBNAME ${REQUESTED_BOOST_LIBS})
NO_DEFAULT_PATH
)
# Check, if the Boost component was found
if("${LIBNAME}" STREQUAL "${LIBNAME}-NOTFOUND")
message(FATAL_ERROR "Boost library ${LIBNAME} was NOT found!
Please, set variable BOOST_LIBRARYDIR to the correct path and check the library names
format in your Boost installation.")
message("${LIBNAME} ${${LIBNAME}}")
# Make the target of the same name as the library
......
Subproject commit f7371ecb0652555ec89cb28e58c18fda56685985
Subproject commit 507ad00a0ad1ce6e8833f2f529fa1e9150c446c0
Subproject commit 9a8474e7a259fa5348658a651cd19af216749674
Subproject commit 9836f21d07b1bf799e6877324268708f61c01f73
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment