From e8d27be32de5bc8dad3ce982205229beca7fafd3 Mon Sep 17 00:00:00 2001 From: luckiezhou Date: Mon, 13 Aug 2018 21:15:33 +0800 Subject: [PATCH] [Fixed] bugs in cmake and typo in error message --- core/algorithm/CMakeLists.txt | 11 ++++++++--- core/graph/CMakeLists.txt | 2 +- scripts/test.py | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/algorithm/CMakeLists.txt b/core/algorithm/CMakeLists.txt index c666b75..e963281 100644 --- a/core/algorithm/CMakeLists.txt +++ b/core/algorithm/CMakeLists.txt @@ -95,9 +95,14 @@ if(Boost_FOUND) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.54.0 COMPONENTS python) if(NOT Boost_FOUND) - message("[Warning] boost_python not detected by cmake, we will continue - building because sometimes cmake fails to detect an existing - boost_python library") + if(NOT "$ENV{BOOST_PYTHON_LIBNAME}" STREQUAL "") + message("boost_python not detected by cmake, trying custom lib name + $ENV{BOOST_PYTHON_LIBNAME}") + else() + message(FATAL_ERROR "boost_python not detected by cmake, try setting + environment variable $BOOST_PYTHON_LIBNAME for custom library name") + endif() + set (Boost_LIBRARIES "${Boost_LIBRARIES}-l boost_python-2.7") endif() ELSEIF(NOT Boost_FOUND) MESSAGE(FATAL_ERROR "Unable to find correct Boost version. Did you set BOOST_ROOT?") diff --git a/core/graph/CMakeLists.txt b/core/graph/CMakeLists.txt index df462f8..49dda6b 100644 --- a/core/graph/CMakeLists.txt +++ b/core/graph/CMakeLists.txt @@ -61,7 +61,7 @@ if(Boost_FOUND) find_package(Boost 1.54.0 COMPONENTS python) if(NOT Boost_FOUND) if(NOT "$ENV{BOOST_PYTHON_LIBNAME}" STREQUAL "") - message("boost_python node detected by cmake, trying custom lib name + message("boost_python not detected by cmake, trying custom lib name $ENV{BOOST_PYTHON_LIBNAME}") else() message(FATAL_ERROR "boost_python not detected by cmake, try setting diff --git a/scripts/test.py b/scripts/test.py index 22f9cec..a9ad19b 100644 --- a/scripts/test.py +++ b/scripts/test.py @@ -10,14 +10,14 @@ try: import core.mygraph except ImportError as e: - raise RuntimeError("mygraph submodule not avaiable: {}".format(e.message)) + raise RuntimeError("mygraph submodule not avaiable: {}".format(str(e))) print("OK\n") print("Checking c extension ...") try: import core.algorithm.dynamic_triad_cimpl except ImportError as e: - raise RuntimeError("c extention not available: {}".format(e.messages)) + raise RuntimeError("c extention not available: {}".format(str(e))) print("OK\n") print("Checking Cython modules ...")