[CMake] Asm support
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Mar 15 16:19:41 EDT 2011
Hi,
On Tuesday 15 March 2011, Robert Bielik wrote:
> Robert Bielik skrev 2011-03-15 08:59:
> > Using 2.8.4, I'm trying to add an assembler file with cmake (64 bit
> > VS2008 build), but I'm at a loss, I tried:
> >
> > ENABLE_LANGUAGE(ASM_MASM)
> > IF(NOT CMAKE_ASM_MASM_COMPILER_WORKS)
> > MESSAGE(FATAL_ERROR "No assembler found!")
> > ENDIF(NOT CMAKE_ASM-MASM_COMPILER_WORKS)
> >
> > but the ml64 assembler does not seem to be found, cmake output is:
> >
> > -- The ASM_MASM compiler identification is unknown
> > -- Didn't find assembler
> > -- Loaded CMakeASM_MASMInformation - ASM_MASM support is still
> > experimental, please report issues CMake Error at
> > common/external/cryptopp561/CMakeLists.txt:259 (MESSAGE): No assembler
> > found!
>
> Further information: In CMakeDetermineASMCompiler.cmake
> ${_CMAKE_USER_C_COMPILER_PATH} & ${_CMAKE_USER_CXX_COMPILER_PATH} aswell as
> ${_CMAKE_TOOLCHAIN_LOCATION} are empty.
>
> And even though I set CMAKE_ASM_MASM_COMPILER explicitly in advanced view,
> the added assembler file never gets built (its included in the project, but
> cannot be "compiled")
In current cmake master, there is this code in
CMakeDetermineASMCompiler.cmake:
...
ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect"
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST
${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be
preset !")
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
# Find the compiler.
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER
NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST}
PATHS ${_CMAKE_USER_C_COMPILER_PATH}
${_CMAKE_USER_CXX_COMPILER_PATH}
DOC "Assembler" NO_DEFAULT_PATH)
ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER
NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST}
PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler")
So, in your case, ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} should be set
to "ml" or "ml64".
This should then go into the second find_program() call, and there it should
be found. The assembler should AFAIK be in the same directory as cl.exe.
Assembler support works currently only in the makefile-based generators.
For having assembler supported in VisualStudio contributions from users are
needed (I don't have Windows, so I can't do that).
Alex
More information about the CMake
mailing list