Compiling 32-bit vs 64-bit project using CMake

后端 未结 4 1144
日久生厌
日久生厌 2020-12-24 11:54

How do I specify that CMake should use a different link_directories value depending on whether the target is 32-bit or 64-bit? For example, 32-bit binaries need

4条回答
  •  一生所求
    2020-12-24 12:48

    For Boost specifically, you should use

    FIND_LIBRARY(Boost 1.44 COMPONENTS ...)

    Then the CMake variable Boost_LIBRARY_DIRS will contain the correct library path, which has to be set using LINK_DIRECTORIES, e.g.

    LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})

    The more general case is correctly described in user434507's answer.

提交回复
热议问题