[CMake] 64bit linking on linux
Aaron Turner
synfinatic at gmail.com
Wed Feb 18 13:30:10 EST 2009
On Wed, Feb 18, 2009 at 6:52 AM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> Birju Prajapati wrote:
>>
>> 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")
>>
>>
>
> That is not the preferable way to do this. As it hard codes flags into the
> CMake file. The way I would do it is:
>
> export CXXFLAGS=-m64
> export CFLAGS=-m64
> export LDFLAGS=-m64
>
> cmake ../myproject
>
> If those environment variables are set BEFORE you run cmake, then cmake will
> put them into the cache correctly.
Couldn't you use the check_c_source_runs() macro to test if your
system supports the -m64 flag? That way you wouldn't need to require
the user to specify it (always fraught with peril).
--
Aaron Turner
http://synfin.net/
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little
temporary Safety,
deserve neither Liberty nor Safety.
-- Benjamin Franklin
More information about the CMake
mailing list