Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPXConfig.cmake should include TCMALLOC_LIBRARY and TCMALLOC_INCLUDE_DIR #1377

Closed
kynan opened this issue Feb 17, 2015 · 5 comments
Closed

Comments

@kynan
Copy link

kynan commented Feb 17, 2015

If TCMalloc is installed in a non-standard location i.e. TCMALLOC_LIBRARY and TCMALLOC_INCLUDE_DIR are set in the CMake cache, these variables should be written to HPXConfig.cmake. Not doing that causes find_package(HPX REQUIRED) to fail with the familiar

Could NOT find TCMalloc (missing:  TCMALLOC_LIBRARY TCMALLOC_INCLUDE_DIR)

In particular, this causes the build test (tests/unit/build) to fail.

@kynan
Copy link
Author

kynan commented Feb 17, 2015

The following patch works for me:

diff --git a/cmake/templates/HPXConfig.cmake.in b/cmake/templates/HPXConfig.cmake.in
index 9ba4dc3..dbc0060 100644
--- a/cmake/templates/HPXConfig.cmake.in
+++ b/cmake/templates/HPXConfig.cmake.in
@@ -36,6 +36,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} @CXX11_FLAG@")

 set(HPX_BOOST_ROOT @BOOST_ROOT@)
 set(HPX_MALLOC @HPX_MALLOC@)
+set(TCMALLOC_LIBRARY @TCMALLOC_LIBRARY@)
+set(TCMALLOC_INCLUDE_DIR @TCMALLOC_INCLUDE_DIR@)

 if(NOT HPX_CMAKE_LOGLEVEL)
   set(HPX_CMAKE_LOGLEVEL "WARN")

@kynan
Copy link
Author

kynan commented Feb 17, 2015

Maybe better make it conditional:

diff --git a/cmake/templates/HPXConfig.cmake.in b/cmake/templates/HPXConfig.cmake.in
index 9ba4dc3..434ccc8 100644
--- a/cmake/templates/HPXConfig.cmake.in
+++ b/cmake/templates/HPXConfig.cmake.in
@@ -36,6 +36,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} @CXX11_FLAG@")

 set(HPX_BOOST_ROOT @BOOST_ROOT@)
 set(HPX_MALLOC @HPX_MALLOC@)
+if("${HPX_MALLOC}" STREQUAL "tcmalloc")
+  set(TCMALLOC_LIBRARY @TCMALLOC_LIBRARY@)
+  set(TCMALLOC_INCLUDE_DIR @TCMALLOC_INCLUDE_DIR@)
+endif()

 if(NOT HPX_CMAKE_LOGLEVEL)
   set(HPX_CMAKE_LOGLEVEL "WARN")

@sithhell
Copy link
Member

This is not a problem specific to tcmalloc but probably affects all other allocators.

@kynan
Copy link
Author

kynan commented Feb 17, 2015

Suppose so. I've only tried tcmalloc...

@sithhell
Copy link
Member

Thanks for the report! I think the latest changes should take care of the problem at hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants