问题描述
我正在尝试安装 ismrmrd 并遵循Windows的安装指南.
在步骤cmake-gui.exe
中,我的cmake找不到安装的Boost.
在CMakeLists.txt
中添加这些行之后,结果变得很有趣.
有什么想法吗?
UPDATE 8/21
感谢 vre 和 user1234567
现在我更改为提高1.66,但仍然没有运气.
新的屏幕截图显示FindBoost现在没有抱怨.但是仍然没有发现任何提振.
UPDATE 8/22
添加后
cmake_policy(SET CMP0074 NEW)
和
通过 vre 的建议将 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})
转换为CMakeLists.txt
产生的错误成为此屏幕截图
由于渴望评论,我尝试提出一个食谱:
仅使用Boost标头/静态库所需的命令是:
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)
仅使用标头库仅使用
find_package(Boost)
否则,在COMPONENTS关键字之后命名要使用的组件(库)并使用
find_package(Boost COMPONENTS <e.g. filesystem system ...>)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_definitions( "-DHAS_BOOST" )
endif()
稍后在调用中仅引用Header Boost引用导入的目标(库)
target_link_libraries(yourproject Boost::boost)
或在调用中用于命名库组件
target_link_libraries(yourproject ${Boost_LIBRARIES})
在对有关Boost和Boost组件的CMakeLists.txt进行更改时,请务必始终删除构建目录中的CMakeCache.txt文件,因为它可能会缓存上一次CMake运行的值.
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.
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.
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
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.
这篇关于CMake同时发现和未发现增强的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!