Compiling 32-bit vs 64-bit project using CMake

后端 未结 4 1158
日久生厌
日久生厌 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:39

    You do something along these lines

      if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
        set( BOOST_LIBRARY "/boost/win64/lib" )
      else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
        set( BOOST_LIBRARY "/boost/win32/lib" )
      endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
      set( CMAKE_EXE_LINKER_FLAGS ${BOOST_LIBRARY} )
    

提交回复
热议问题