[CMake] 64bit linking on linux

Birju Prajapati Birju.Prajapati at schneidertrading.com
Wed Feb 18 09:32:10 EST 2009


I've figured it out. I added the following lines into the root
CMakeLists.txt file:

 

SET(CMAKE_CXX_FLAGS "-m64")

SET(CMAKE_C_FLAGS "-m64")

SET(CMAKE_EXE_LINKER_FLAGS "-m64")

SET(CMAKE_MODULE_LINKER_FLAGS "-m64")

SET(CMAKE_SHARED_LINKER_FLAGS "-m64")

 

Could someone point me to where this is in the documentation? 

I couldn't find this anywhere in

 

http://www.cmake.org/cmake/help/cmake2.6docs.html

 

and had to figure it out by grepping.

 

TIA,

Birju

 

From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
Of Birju Prajapati
Sent: 18 February 2009 13:32
To: cmake at cmake.org
Subject: [CMake] 64bit linking on linux

 

Hi,

I have a simple CMakeLists.txt file, in a directory called 'multicast':

 

cmake_minimum_required(VERSION 2.6)

include_directories(../.. /usr/local/include/boost-1_38)

add_library(spreadx_multicast SHARED Message.cpp MulticastChannel.cpp)

 

This successfully gives me a 64 bit .so:

 

birju at cavewks7181:~/Dev/spreadx/multicast$ file libspreadx_multicast.so

libspreadx_multicast.so: ELF 64-bit LSB shared object, x86-64, version 1
(SYSV), dynamically linked, not stripped

 

However, there is a problem when I try and invoke that from a directory
above with the following CMakeLists.txt file:

 

cmake_minimum_required (VERSION 2.6)

project (SPREADX)

add_subdirectory (multicast)

 

This gives me a 32 bit .so:

birju at cavewks7181:~/Dev/spreadx$ file multicast/libspreadx_multicast.so

multicast/libspreadx_multicast.so: ELF 32-bit LSB shared object, Intel
80386, version 1 (SYSV), dynamically linked, not stripped

 

Why does it in one case generate a 64 bit lib, and in the other, a 32
bit one?

 

TIA,

Birju

 

 

 

Schneider Trading
4th Floor,
25 Copthall Avenue
London EC2R 7BP

________________________________

Message from: Birju.Prajapati at schneidertrading.com
Message to: cmake at cmake.org
Attached files: 0

This e-mail and any files transmitted with it are confidential, may be
legally privileged, and are for the sole use of the intended recipient.
Copyright in this e-mail and any accompanying document created by us is
owned by us. If you are not the intended recipient of this e-mail or any
part of it please telephone our IT Department at the number shown above
or by e-mail at info at schneidertrading.com. 

You should not use or disclose to any other person the contents of this
e-mail or its attachments (if any), nor take copies. This e-mail is not
a representation or warranty and is not intended nor should it be taken
to create any legal relations, contractual or otherwise.

Schneider Trading Associates Ltd (Registration No. 3692131) is
incorporated in England and Wales and the registered office is at 25
Copthall Avenue, London EC2R 7BP. The company is authorised and
regulated by the Financial Services Authority
 

 
Schneider Trading
4th Floor,
25 Copthall Avenue
London EC2R 7BP

--------------------------------------------------------



Message from: Birju.Prajapati at schneidertrading.com
Message to: cmake at cmake.org
Attached files: 0
This e-mail and any files transmitted with it are confidential, may be legally privileged, and are for the sole use of the intended recipient. Copyright in this e-mail and any accompanying document created by us is owned by us. If you are not the intended recipient of this e-mail or any part of it please telephone our IT Department at the number shown above or by e-mail at info at schneidertrading.com. 
You should not use or disclose to any other person the contents of this e-mail or its attachments (if any), nor take copies. This e-mail is not a representation or warranty and is not intended nor should it be taken to create any legal relations, contractual or otherwise.
Schneider Trading Associates Ltd (Registration No. 3692131) is incorporated in England and Wales and the registered office is at 25 Copthall Avenue, London EC2R 7BP. The company is authorised and regulated by the Financial Services Authority
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090218/061b8d21/attachment.htm>


More information about the CMake mailing list