0

I am trying to install ismrmrd and following the installation guide for Windows.

In the step cmake-gui.exe my cmake is not finding installed Boost.

After adding those lines to CMakeLists.txt the result became interesting.

CMake error screen shot

Any ideas?


UPDATE 8/21

thanks vre and user1234567

Now I changed to boost 1.66 and still no luck.

The new screenshot shows FindBoost is not complain anything now. But still not any boost found. new screenshot


UPDATE 8/22

After adding

cmake_policy(SET CMP0074 NEW)

and

set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) find_package(Boost REQUIRED system filesystem) include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(ismrmrd ${Boost_LIBRARIES}) into CMakeLists.txt by the suggestion from vre

The resulting error became this screenshot enter image description here

kaltu
  • 330
  • 5
  • 17
  • You might need to add a variable to your CMakeLists.txt `set(Boost_ADDITIONAL_VERSIONS 1.68.0 1.68)` as your CMake release date is older than the release date of your Boost version. FindBoost.cmake only knows Boost versions before its release date not newer ones. – vre Aug 21 '18 at 18:23
  • For Boost 1.68 you need the lastest CMake master. For your CMake version, 1.67 or older should work. Cf. https://stackoverflow.com/a/42124857/2799037 – usr1234567 Aug 21 '18 at 22:13
  • Did you build boost yourself or used a prebuilt version from this site `https://sourceforge.net/projects/boost/files/boost-binaries/` ? They are the maintainers of BOOST and provide binaries for lots of MSVC compilers. To correctly use Boost static libraries you should add `set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) find_package(Boost REQUIRED system filesystem) include_directories(${Boost_INCLUDE_DIRS}) ` and to link against it `target_link_libraries(your_target ${Boost_LIBRARIES})` to your CMakeLists.txt file. – vre Aug 22 '18 at 11:19
  • [@vre](https://stackoverflow.com/users/5251059/vre) I do download prebuilt version from sourceforge, but I ran `bootstrap.bat` and `b2.exe variant=debug,release link=static runtime-link=static address-model=64` from [link](https://github.com/cryptonotefoundation/cryptonote/issues/119#issuecomment-403515821) – kaltu Aug 22 '18 at 14:51
  • You are rebuilding boost. But that's not needed if you use the prebuilt package from the sourceforge adress mentioned above. It comes with dynamic and static libraries, release and debug mode built for the named compiler. All that is needed is to reference it correctly in the CMakeLists.txt. What compiler are you using? – vre Aug 22 '18 at 15:00
  • I think it's using my installed `VC++ 2017 version 15.8 v14.15 latest v141 tools`, so i have a line `set(BOOST_LIBRARYDIR "C:/local/boost_1_66_0/lib64-msvc-14.1")` in `CMakeLists.txt` – kaltu Aug 22 '18 at 15:07
  • So you should download and install https://sourceforge.net/projects/boost/files/boost-binaries/1.66.0/boost_1_66_0-msvc-14.1-64.exe to "C:/local/boost_1_66_0" and add a variable BOOST_ROOT to your CMakeLists.txt file before setting the other variables I mentioned in a previous post, e.g. `set(BOOST_ROOT C:/local/boost_1_66_0)`. Be sure to delete the CMakeCache.txt file from the build directory, because results of a previous run may not be overwritten otherwise. I always recommend this procedure to get your CMakeLists.txt working first, later you can figure out how to build Boost by yourself. – vre Aug 22 '18 at 20:36
  • Can you share your CMakeLists.txt? It's easier to recommend some changes by viewing the script than to guess the missing pieces from the error messages. – vre Aug 22 '18 at 20:39
  • @vre The CMakeLists.txt is a modified version from [ismrmrd](https://github.com/ismrmrd/ismrmrd/blob/master/CMakeLists.txt) every single addition is noted in the main ask body. A copy is [here](https://jpst.it/1mCKN). – kaltu Aug 22 '18 at 21:15

1 Answers1

1

As it is to long for comments I try to come up with a recipe:

The commands needed for using Boost header only/static libraries are:

set(Boost_ADDITIONAL_VERSIONS 1.66.0 1.66)
set(BOOST_ROOT "C:/local/boost_1_66_0")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)

For using solely header only libraries use

find_package(Boost)

otherwise name the components (libraries) to be used after the COMPONENTS keyword and use

find_package(Boost COMPONENTS <e.g. filesystem system ...>)

if (Boost_FOUND)
  include_directories(${Boost_INCLUDE_DIRS})
  add_definitions( "-DHAS_BOOST" )
endif()

Later you reference the imported targets (libraries) for header only Boost in a call

target_link_libraries(yourproject Boost::boost)

or for named library components in a call

target_link_libraries(yourproject ${Boost_LIBRARIES})

Be sure to always delete the CMakeCache.txt file in the build directory when making changes to the CMakeLists.txt regarding Boost and Boost components, as it might cache the values of a previous CMake run.

vre
  • 6,041
  • 1
  • 25
  • 39