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

Finding Boost libraries when building #4

Open
eldiener opened this issue May 9, 2015 · 6 comments
Open

Finding Boost libraries when building #4

eldiener opened this issue May 9, 2015 · 6 comments

Comments

@eldiener
Copy link

eldiener commented May 9, 2015

Attempting to configure cmake for building the tools it cannot find my Boost libraries. Your doc mentions that the Boost headers are off of the main Boost directory as 'include/boost/' but that has never been the case in Boost distributions on Windows. There the Boost headers are in the 'boost' subdirectory and the Boost libraries are in the 'lib' subdirectory. If I have a Boost directory at 'C:\Utilities\Boost\boost_1_57_0' what do I specify to get the tools built in cmake ?

@mikael-s-persson
Copy link
Owner

Yeah... finding boost on Windows is always a pain in the neck. My cmake code for dealing with custom boost directories dates back quite a while, it's very possible that it doesn't work any more. These days, you only encounter Windows programmers once in a blue moon, so it hasn't been a priority, and Windows programmers are used to having to manually tweak everything to make things work.

The CMake code that takes care of this is found in the BoilerplateMacros.cmake module file, and it reads as follows:

# if a custom path for boost is provided, than use that (and suppress system paths).
if(EXISTS "${CUSTOM_BOOST_PATH}/include/boost")
  set(Boost_INCLUDE_DIR "${CUSTOM_BOOST_PATH}/include")
  set(Boost_LIBRARY_DIR "${CUSTOM_BOOST_PATH}/lib")
  set(Boost_NO_SYSTEM_PATHS TRUE)
endif()

You could just remove the if-statement and replace the three set-commands with hard-coded paths to your particular distribution and build of boost. But I would highly appreciate it if you could suggest (or make a pull request) a replacement for this bit of code that would work with current boost Windows distributions. I just don't have access to a Windows computer to test it out myself, so I'd appreciate it if you could work that out.

@eldiener
Copy link
Author

eldiener commented May 9, 2015

In Windows if the CUSTOM_BOOST_PATH is a top-level Boost installation, then the include directory is CUSTOM_BOOST_PATH/boost and the library directory is CUSTOM_BOOST_PATH/libs. This is true for every Windows Boost distribution. I do not know CMake well enough to know how it distinguishes between Windows and any other OS, which I would have to know to change the code above.

If you make the change based on the information above, since I suspect you know CMake much better than I do, and put it on some git branch of templight-tools, I will be glad to test it for you under Windows.

Otherwise I will search how to ask CMake if it is executing under Windows or not, fork your code, and create a pull request once my testing is complete.

@wmamrak
Copy link
Contributor

wmamrak commented May 9, 2015

These days, you only encounter Windows programmers once in a blue moon

Three active users here, two using Windows 😄

how to ask CMake if it is executing under Windows or not

http://www.cmake.org/cmake/help/v3.2/variable/CMAKE_HOST_WIN32.html

@eldiener
Copy link
Author

eldiener commented May 9, 2015

The entire CUSTOM_BOOST_PATH will not work at all. This is because you need Boost_LIBRARIES to also be set in your logic.

I manage to get templight_convert.exe built by setting BOOST_ROOT and BOOST_LIBRARYDIR correctly to a Boost 1.49 distribution where I had built the needed libs. BTW your build fails on the latest versions of Boost.

@schulmar
Copy link

It has been some time since I used Boost with CMake under Windows but it worked right out of the box for me back then.

Reading through BoilerplateMacros.cmake I noticed some things that might relate to this issue:

  1. Explicit versions of boost: This list might be a nightmare to maintain/keep up to date. What are the real restrictions on the version? Maybe there should be a simple check after loading that tells the user when the version is not supported and were to turn for help?
  2. On CUSTOM_BOOST_PATH the variables Boost_{INCLUDE, LIBRARY}_DIR are set.
    I am not sure if these should be actually one of Boost_INCLUDE_DIRS or Boost_INCLUDEDIR (according to documentation) to interact with the rest of cmake's boost finding process.
  3. There are some manual fixes for problems like:

@Asher-
Copy link

Asher- commented Jul 22, 2017

See details in Pull Request #8 to compile.

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

No branches or pull requests

5 participants