[CMake] JWASM support
Dmitry Bely
dmitry.bely at gmail.com
Sat Jan 31 08:12:24 EST 2009
I am trying to use JWASM (http://www.japheth.de/JWasm.html) with CMake
2.6.2 to do rather unusual thing: cross-compile a C++ project with
MASM-syntax .asm files for Linux under Windows. JWASM itself emulates
MASM excellently and has no problem generating COFF or ELF files but
now CMake comes into play.
First of all, I added JWASM config files into CMake:
*** CMakeASM_JWASMInformation.cmake
SET(ASM_DIALECT "_JWASM")
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
IF(CMAKE_HOST_WIN32)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT
"<CMAKE_ASM${ASM_DIALECT}_COMPILER> -nologo -coff <FLAGS> -Fo<OBJECT>
<SOURCE>")
ELSE(CMAKE_HOST_WIN32)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT
"<CMAKE_ASM${ASM_DIALECT}_COMPILER> -nologo -elf <FLAGS> -Fo<OBJECT>
<SOURCE>")
ENDIF(CMAKE_HOST_WIN32)
INCLUDE(CMakeASMInformation)
SET(ASM_DIALECT)
*** CMakeDetermineASM_JWASMCompiler.cmake
# determine the compiler to use for ASM using Intel syntax
SET(ASM_DIALECT "_JWASM")
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT jwasm)
INCLUDE(CMakeDetermineASMCompiler)
SET(ASM_DIALECT)
*** CMakeTestASM_JWASMCompiler.cmake
# This file is used by EnableLanguage in cmGlobalGenerator to
# determine that that selected ASM_JWASM compiler can actually compile
# and link the most basic of programs. If not, a fatal error
# is set and cmake stops processing commands and will not generate
# any makefiles or projects.
SET(ASM_DIALECT "_JWASM")
INCLUDE(CMakeTestASMCompiler)
SET(ASM_DIALECT)
and created a project CMakeLists.txt (omitting irrelevant detais):
...
project (TestProject CXX ASM_JWASM)
...
include_directories (
c:/some/include/dir
)
...
add_library (${CMAKE_PROJECT_NAME} SHARED
test.cpp
test.asm
)
To build a project I used cygwin-compiled cmake as the gcc cross
compiler is also cygwin-compiled (but jwasm is a plain Win32 app).
Now there is a problem. During the build JWASM is invoked (and fails)
the following way:
/cygdrive/c/Util/jwasm.exe -nologo -elf -DTestProject_EXPORTS
-I/cygdrive/c/some/include/dir -Fo`cygpath -w
CMakeFiles/TestProject.dir/test.asm.o` `cygpath -w
/cygdrive/c/Work/TestProject/test.asm`
Unknown option /cygdrive/c/some/include/dir
-FoCMakeFiles\TestProject.dir\test.asm.o c:\Work\TestProject\test.asm.
Use /? for list of options.
So there are some questions:
1. Why source and target parameters are wrapped with cygpath, but -I
options do not? What part of CMake is responsible for adding these
cygpaths?
2. Does include_directories always affect all compilers? Is it
possible to ignore them for some specific ones?
- Dmitry Bely
More information about the CMake
mailing list