llvm.org GIT mirror llvm / b0c5699
CMake: Support for building 32 bit mode libs and binaries on Linux/x86-64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58677 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
2 changed file(s) with 16 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
7171
7272 add_definitions( -D__STDC_LIMIT_MACROS )
7373 add_definitions( -D__STDC_CONSTANT_MACROS )
74
75 set(LLVM_PLO_FLAGS "" CACHE
76 STRING "Flags for creating partially linked objects.")
77
78 if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
79 # TODO: support other platforms and toolchains.
80 option(BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
81 if( BUILD_32_BITS )
82 message(STATUS "Building 32 bits executables and libraries.")
83 add_definitions( -m32 )
84 set( CMAKE_EXE_LINKER_FLAGS "-m32 ${CMAKE_EXE_LINKER_FLAGS}" )
85 set( CMAKE_LINK_LIBRARY_FLAG "-m32 ${CMAKE_LINK_LIBRARY_FLAG}" )
86 set( LLVM_PLO_FLAGS -melf_i386 ${LLVM_PLO_FLAGS} )
87 endif( BUILD_32_BITS )
88 endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
7489
7590 if( MSVC )
7691 add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
2323 DEPENDS ${lib}
2424 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
2525 COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
26 COMMAND ld -r *${CMAKE_CXX_OUTPUT_EXTENSION} -o ${pll}
26 COMMAND ld "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
2727 COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION}
2828 )
2929 target_name_of_partially_linked_object(${lib} tnplo)