On Tue, Apr 16, 2013 at 8:13 AM, Mathias Gaunard < mathias.gaunard@ens-lyon.org> wrote:
If you're building 32 and 64 bit on the same machine, then at least of one these is cross-compilation. With CMake (and other build systems), cross-compilation cannot happen automatically, you have to specify manually which directories to use to find libraries. Using the default may easily result in conflicts with the native libraries installed.
With CMake on windows you just have to use the "Visual Studio x64" to compile for 64 bit and the non x64 to compile in 32 bit. (see http://cmake.org/cmake/help/v2.8.10/cmake.html#section_Generators) The CMake scripts can take into account in which mode libraries have to be used and it works well for libraries that take this into account, not like boost. You can consider this problem as Windows/VS-specific if you will. I have no idea if the same problem is true on linux or with gcc/mingw/clang.
This is not a Boost-specific problem, this will affect any use of a find module and even find_library.
Obviously it IS a boost specific problem as it is one of the few libraries which don't have any basic way of differenciate 32 and 64bit binaries. The CMake module can't rely on any such knowledge (on Windows?) to correctly find the right binaries depending on both the current mode selected on the CMake configuration level. All other libraries I use provide both 32 and 64 bit binaries at specific emplacements (relative to where they are installed) and the associated CMake module will chose one or the other depending on the mode choosen on configuration. Boost just makes things complicated by not specifying a way to differenciate these binaries (again, on Windows). I understand the default lib directory should contain the native binaries. Now, would there be another solution to help with CMake modules implementation to get the right binaries depending on the generator choice?
Currently you have to specify an undocumented CMake variable manually
to do this.
Boost_DIR, BOOST_ROOT, BOOSTROOT, BOOST_INCLUDEDIR and BOOST_LIBRARYDIR are all documented.
If you read the link you would know I'm talking about the CMake help documentation which don't describe BOOST_LIBRARYDIR at all. When you're using CMake to configure your libraries, that's where you look. I filed a ticket for this. Joel Lamotte