Re: [CMake] Proper way to support 64bit and 32bit builds

2016-10-29 Thread J Decker
I would think the find is using something like...  so you'll need to adjust
cmake_sizeof_void_p

if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
DEFINE_DEFAULT( __64__ ON )
else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
DEFINE_DEFAULT( __64__ OFF )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
SET( __64__ ${__64__} CACHE BOOL "Enable 64 considerations" )


On Sat, Oct 29, 2016 at 3:22 AM, cen  wrote:

> Hi
>
> Once I switch to 32bit builds, CMake fails to recognise that
> glibc-devel.i686 is not installed resulting in an error when running make.
> In the same way, my own FindGMP fails to recognize that gmp-devel.i686 is
> not installed. I need CMake to fail if these things are missing.
> At least for the compiler part, I'm pretty sure I am missing some var or
> flag to tell CMake I expect a 32 bit build.
>
> This is what I use to switch between builds in CMakeLists.txt (ARCH var is
> irrelevant here,  I use it later on for CPack):
>
> if (BUILD_32)
> set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
> "-m32" LINK_FLAGS "-m32")
> MESSAGE(STATUS "Excluding 64bit library paths from search.")
> set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
> set(ARCH i686)
> elseif (BUILD_64)
> set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
> "-m64" LINK_FLAGS "-m64")
> set(ARCH amd64)
> else()
> set(ARCH amd64)
> endif()
>
>
> For the FindGMP module, I am not really sure what the best practice
> is.Does the BUILD_32 and BUILD_64 flag propagate into the FindGMP? Do I
> explicitly specify paths for 32bit libs (eg: /usr/lib64) or can  cmake be
> smarter than this?
> --
>
> 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/opensou
> rce/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-- 

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

Re: [CMake] Proper way to support 64bit and 32bit builds

2016-10-29 Thread Konstantin Tokarev


29.10.2016, 16:46, "cen" :
> I tried setting CXXFLAGS and CMAKE_CXX_FLAGS to -m32 before the
> project() call but nothing changed. I could make it fail with
> "CXXFLAGS=-m32 cmake -G ..." from command line but this seems wrong. A
> minimal CMakeLists.txt example would be nice.

Use toolchain file

>
> Hendrik Sattler je 29. 10. 2016 ob 15:25 napisal:
>>  You need to set these compiler flags BEFORE the project() call to let CMake 
>> detect all stuff properly. There is a CMake variable telling you the size of 
>> a void*.
>>
>>  Am 29. Oktober 2016 12:22:07 MESZ, schrieb cen :
>>>  Hi
>>>
>>>  Once I switch to 32bit builds, CMake fails to recognise that
>>>  glibc-devel.i686 is not installed resulting in an error when running
>>>  make.
>>>  In the same way, my own FindGMP fails to recognize that gmp-devel.i686
>>>  is not installed. I need CMake to fail if these things are missing.
>>>  At least for the compiler part, I'm pretty sure I am missing some var
>>>  or
>>>  flag to tell CMake I expect a 32 bit build.
>>>
>>>  This is what I use to switch between builds in CMakeLists.txt (ARCH var
>>>
>>>  is irrelevant here, I use it later on for CPack):
>>>
>>>  if (BUILD_32)
>>>  set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
>>>  "-m32" LINK_FLAGS "-m32")
>>>   MESSAGE(STATUS "Excluding 64bit library paths from search.")
>>>   set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
>>>   set(ARCH i686)
>>>  elseif (BUILD_64)
>>>  set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
>>>  "-m64" LINK_FLAGS "-m64")
>>>   set(ARCH amd64)
>>>  else()
>>>   set(ARCH amd64)
>>>  endif()
>>>
>>>  For the FindGMP module, I am not really sure what the best practice
>>>  is.Does the BUILD_32 and BUILD_64 flag propagate into the FindGMP? Do I
>>>
>>>  explicitly specify paths for 32bit libs (eg: /usr/lib64) or can cmake
>>>  be smarter than this?
>
> --
>
> 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

-- 
Regards,
Konstantin
-- 

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

Re: [CMake] Proper way to support 64bit and 32bit builds

2016-10-29 Thread cen
I tried setting CXXFLAGS and CMAKE_CXX_FLAGS to -m32 before the 
project() call but nothing changed. I could make it fail with 
"CXXFLAGS=-m32 cmake -G ..." from command line but this seems wrong. A 
minimal CMakeLists.txt example would be nice.



Hendrik Sattler je 29. 10. 2016 ob 15:25 napisal:

You need to set these compiler flags BEFORE the project() call to let CMake 
detect all stuff properly. There is a CMake  variable telling you the size of a 
void*.


Am 29. Oktober 2016 12:22:07 MESZ, schrieb cen :

Hi

Once I switch to 32bit builds, CMake fails to recognise that
glibc-devel.i686 is not installed resulting in an error when running
make.
In the same way, my own FindGMP fails to recognize that gmp-devel.i686
is not installed. I need CMake to fail if these things are missing.
At least for the compiler part, I'm pretty sure I am missing some var
or
flag to tell CMake I expect a 32 bit build.

This is what I use to switch between builds in CMakeLists.txt (ARCH var

is irrelevant here,  I use it later on for CPack):

if (BUILD_32)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
"-m32" LINK_FLAGS "-m32")
 MESSAGE(STATUS "Excluding 64bit library paths from search.")
 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
 set(ARCH i686)
elseif (BUILD_64)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
"-m64" LINK_FLAGS "-m64")
 set(ARCH amd64)
else()
 set(ARCH amd64)
endif()


For the FindGMP module, I am not really sure what the best practice
is.Does the BUILD_32 and BUILD_64 flag propagate into the FindGMP? Do I

explicitly specify paths for 32bit libs (eg: /usr/lib64) or can  cmake
be smarter than this?


--

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


Re: [CMake] Proper way to support 64bit and 32bit builds

2016-10-29 Thread Hendrik Sattler
You need to set these compiler flags BEFORE the project() call to let CMake 
detect all stuff properly. There is a CMake  variable telling you the size of a 
void*.


Am 29. Oktober 2016 12:22:07 MESZ, schrieb cen :
>Hi
>
>Once I switch to 32bit builds, CMake fails to recognise that 
>glibc-devel.i686 is not installed resulting in an error when running
>make.
>In the same way, my own FindGMP fails to recognize that gmp-devel.i686 
>is not installed. I need CMake to fail if these things are missing.
>At least for the compiler part, I'm pretty sure I am missing some var
>or 
>flag to tell CMake I expect a 32 bit build.
>
>This is what I use to switch between builds in CMakeLists.txt (ARCH var
>
>is irrelevant here,  I use it later on for CPack):
>
>if (BUILD_32)
>set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS 
>"-m32" LINK_FLAGS "-m32")
> MESSAGE(STATUS "Excluding 64bit library paths from search.")
> set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
> set(ARCH i686)
>elseif (BUILD_64)
>set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS 
>"-m64" LINK_FLAGS "-m64")
> set(ARCH amd64)
>else()
> set(ARCH amd64)
>endif()
>
>
>For the FindGMP module, I am not really sure what the best practice 
>is.Does the BUILD_32 and BUILD_64 flag propagate into the FindGMP? Do I
>
>explicitly specify paths for 32bit libs (eg: /usr/lib64) or can  cmake 
>be smarter than this?

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
-- 

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


[CMake] Proper way to support 64bit and 32bit builds

2016-10-29 Thread cen

Hi

Once I switch to 32bit builds, CMake fails to recognise that 
glibc-devel.i686 is not installed resulting in an error when running make.
In the same way, my own FindGMP fails to recognize that gmp-devel.i686 
is not installed. I need CMake to fail if these things are missing.
At least for the compiler part, I'm pretty sure I am missing some var or 
flag to tell CMake I expect a 32 bit build.


This is what I use to switch between builds in CMakeLists.txt (ARCH var 
is irrelevant here,  I use it later on for CPack):


if (BUILD_32)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS 
"-m32" LINK_FLAGS "-m32")

MESSAGE(STATUS "Excluding 64bit library paths from search.")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
set(ARCH i686)
elseif (BUILD_64)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS 
"-m64" LINK_FLAGS "-m64")

set(ARCH amd64)
else()
set(ARCH amd64)
endif()


For the FindGMP module, I am not really sure what the best practice 
is.Does the BUILD_32 and BUILD_64 flag propagate into the FindGMP? Do I 
explicitly specify paths for 32bit libs (eg: /usr/lib64) or can  cmake 
be smarter than this?

--

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