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! # 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 # 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 # Optional user-defined variables
# (can be passed directly to CMake or exported as environmental variables # (can be passed directly to CMake or exported as environmental variables
...@@ -27,6 +28,8 @@ message("FindBoost starting...") ...@@ -27,6 +28,8 @@ message("FindBoost starting...")
# Check if needed Boost components were specified # Check if needed Boost components were specified
if(NOT Boost_FIND_COMPONENTS) 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).") 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() endif()
# Look for a standard boost header file. # Look for a standard boost header file.
...@@ -61,9 +64,11 @@ if(NOT DEPENDENCIES_LINK_TYPE) ...@@ -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'.") message(FATAL_ERROR "Variable DEPENDENCIES_LINK_TYPE is not set! Set it to 'static' or 'shared'.")
endif() endif()
set(LIB_SUFFIX "a") set(LIB_SUFFIX "a") # suffix for Linux static libraries
if("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared" AND WIN32) if("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared" AND WIN32)
set(LIB_SUFFIX "dll") set(LIB_SUFFIX "dll")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "static" AND WIN32)
se(LIB_SUFFIX "lib")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared") elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared")
set(LIB_SUFFIX "so") set(LIB_SUFFIX "so")
endif() endif()
...@@ -104,6 +109,8 @@ find_path( ...@@ -104,6 +109,8 @@ find_path(
# targets, so they may be linked # targets, so they may be linked
set(Boost_LIBRARIES "") set(Boost_LIBRARIES "")
foreach(LIBNAME ${REQUESTED_BOOST_LIBS}) foreach(LIBNAME ${REQUESTED_BOOST_LIBS})
message("Looking for ${LIBNAME}...")
set(${LIBNAME} "${LIBNAME}-NOTFOUND") set(${LIBNAME} "${LIBNAME}-NOTFOUND")
find_library( find_library(
${LIBNAME} ${LIBNAME}
...@@ -121,6 +128,12 @@ foreach(LIBNAME ${REQUESTED_BOOST_LIBS}) ...@@ -121,6 +128,12 @@ foreach(LIBNAME ${REQUESTED_BOOST_LIBS})
NO_DEFAULT_PATH 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}}") message("${LIBNAME} ${${LIBNAME}}")
# Make the target of the same name as the library # 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