[CMake] Linking Boost on Linux on 64bit host and 32bit target

Knox, Kent Kent.Knox at amd.com
Thu Nov 4 11:47:32 EDT 2010


Hi Adam~

[Adam]
Are you sure this logic is right? It looks very odd. Does CMake set WIN32 for a 64-bit Windows toolchain? Didn't you say you were building on Linux?

[Kent]
My software compiles cross platform, and we support windows too.  WIN32 is set for 64bit platforms.  I do have the windows build compiling properly with boost.  I'm specifically having problems with linux.

[Adam]
You don't set ADDITIONAL_VERSIONS. That's probably not the problem.
IIRC, it's:
set(Boost_ADDITIONAL_VERSIONS "1.44 1.44.0")

[Kent]
I did not originally set Boost_ADDITIONAL_VERSIONS.  I did set it now, and ran a clean recompile, but no change.  My Boost_LIBRARIES still came out as:
-- Boost_LIBRARIES: /usr/lib/libboost_program_options-mt.a

Even though I've specified BOOST_LIBRARYDIR as:
BOOST_LIBRARYDIR = /home/kknox/sdk/boost_1_44_0/stage/lib

Kent

-----Original Message-----
From: Adam J Richardson [mailto:fatman at crackmonkey.us] 
Sent: Thursday, November 04, 2010 4:56 AM
To: Knox, Kent
Cc: cmake at cmake.org
Subject: Linking Boost on Linux on 64bit host and 32bit target

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 04 Nov 2010 04:35:57 -0400
cmake-request at cmake.org wrote:
> Hi all~

Hi Kent.

> I have a project using Boost that should compile for both 64bit and 
> 32bit on a 64bit host.  This works fine for a 64bit target, but I 
> can't get this to work for a 32bit target.

I'm having problems linking Boost too. But enough about me.

> In order to compile for 32bit on a 64bit host, I have a -D parameter 
> called BUILD64.  Here is my logic to initialize this var:
> 
> if( WIN32 )
> 	set( BUILD64 ${CMAKE_CL_64} )
> else()
> 	option( BUILD64 "Build a 64-bit product" OFF )
> 	if( BUILD64 )
> 		message( STATUS "64-bit build" )
> 	endif( )
> endif()

Are you sure this logic is right? It looks very odd. Does CMake set
WIN32 for a 64-bit Windows toolchain? Didn't you say you were building on Linux?

> The syntax for finding boost is thus:
> set( Boost_USE_MULTITHREADED ON )
> set( Boost_USE_STATIC_LIBS   ON )
> set( Boost_DETAILED_FAILURE_MSG   ON )
> # set( Boost_DEBUG ON )
> find_package( Boost 1.33.0 COMPONENTS program_options )

You don't set ADDITIONAL_VERSIONS. That's probably not the problem.
IIRC, it's:

set(Boost_ADDITIONAL_VERSIONS "1.44 1.44.0")

... if you wanted to try it anyway.

Regards,
Adam J Richardson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzSgx0ACgkQSUH6dLOqvqmfKwCg6qttDVOXnpqHYoZwfjzUyHax
ubMAniQAF6EYxsIUYkqXPQiMwFxop6uB
=ngaQ
-----END PGP SIGNATURE-----



More information about the CMake mailing list