[CMake] Proper way to support 64bit and 32bit builds
J Decker
d3ck0r at gmail.com
Sat Oct 29 11:51:14 EDT 2016
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 <imbacen at gmail.com> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161029/15156192/attachment.html>
More information about the CMake
mailing list