On 01/11/2016 10:49 AM, Alan Burlison wrote:
> So is the answer here to add -m64 just to CMAKE_EXE_LINKER_FLAGS and 
> CMAKE_SHARED_LINKER_FLAGS and not to CMAKE_STATIC_LINKER_FLAGS? Are 
> CMAKE_STATIC_LINKER_FLAGS only ever used with ar?

Yes and yes.  Actually adding -m64 to CMAKE_{C,CXX}_FLAGS may be
enough because IIRC CMake uses those when invoking the C or C++
compiler front-end for linking a shared library or executable.

> There seems to be an assumption baked into CMake that if the underlying 
> OS is *nix and is 32-bit then all executables that run on it are 32 bit 
> and if it is 64-bit then all the executables are 64-bit as well, so 
> looking at 'uname -p' is sufficient to determine the type of executables 
> that should be produced. Unfortunately that's not correct for either 
> Solaris or Linux.

Very few decisions are actually made based on CMAKE_SYSTEM_PROCESSOR.
Most platform tuning is done based on the compiler id detection results
which uses the actual toolchain.  For example, CMAKE_SIZEOF_VOID_P is
set to the data pointer size detected from the toolchain target.

If you're not adding -m64 to the CMAKE_{C,CXX}_FLAGS until after the
top-level project() command enables the C and CXX languages then it is
too late for those flags to affect the detected target architecture.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to