On Monday 24 August 2009, John Smith wrote: > On Aug 24, 2009, at 12:48 PM, Tyler Roscoe wrote: > > On Sun, Aug 23, 2009 at 09:03:22PM -0400, John Smith wrote: > >> I am using the following test case in an attempt to add a custom > >> command to build an assembly file. The assembly file should be > >> compiled with the C++ compiler driver (which in turn should invoke > >> the > >> assembler after pre-processing), and I am building up a > >> CMAKE_CXX_FLAGS variable from separate pieces: > > > > I think you can just hand your .S files to add_library(). Did you try > > searching the ML archives or google for how to handle assembler files > > with CMake? > > I have tried doing that. However, the net end result is that I get a > rule that invokes the assembler on the assembly source file. My top- > level assembly source file is a shell containing a bunch of platform- > specific conditionals, which in turn guard include directives for > platform-specific assembly source files.
So you have also hit that bug ? http://public.kitware.com/Bug/view.php?id=8392 Can you please try the attached patch ? It introduces a language "ASM-GCC" and removes the extension ".S" from the normal assembler support. Can you please give it a try ? Is it only gcc which supports processing assembler files or do other compilers also support this ? Alex
Index: Modules/CMakeASM-ATTInformation.cmake =================================================================== RCS file: /cvsroot/CMake/CMake/Modules/CMakeASM-ATTInformation.cmake,v retrieving revision 1.2 diff -b -u -p -r1.2 CMakeASM-ATTInformation.cmake --- Modules/CMakeASM-ATTInformation.cmake 5 Nov 2008 23:51:46 -0000 1.2 +++ Modules/CMakeASM-ATTInformation.cmake 8 Mar 2009 19:35:15 -0000 @@ -1,6 +1,6 @@ # support for AT&T syntax assemblers, e.g. GNU as SET(ASM_DIALECT "-ATT") -SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) +SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm) INCLUDE(CMakeASMInformation) SET(ASM_DIALECT) Index: Modules/CMakeASM-GCCInformation.cmake =================================================================== RCS file: Modules/CMakeASM-GCCInformation.cmake diff -N Modules/CMakeASM-GCCInformation.cmake --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Modules/CMakeASM-GCCInformation.cmake 8 Mar 2009 19:35:15 -0000 @@ -0,0 +1,9 @@ +# support for AT&T syntax assemblers with C preprocessing + +SET(ASM_DIALECT "-GCC") + +SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -c <SOURCE> -o <OBJECT> ") + +SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) +INCLUDE(CMakeASMInformation) +SET(ASM_DIALECT) Index: Modules/CMakeDetermineASM-GCCCompiler.cmake =================================================================== RCS file: Modules/CMakeDetermineASM-GCCCompiler.cmake diff -N Modules/CMakeDetermineASM-GCCCompiler.cmake --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Modules/CMakeDetermineASM-GCCCompiler.cmake 8 Mar 2009 19:35:15 -0000 @@ -0,0 +1,6 @@ +# determine the compiler to use for ASM using AT&T syntax, e.g. GNU as + +SET(ASM_DIALECT "-GCC") +SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc ) +INCLUDE(CMakeDetermineASMCompiler) +SET(ASM_DIALECT) Index: Modules/CMakeTestASM-GCCCompiler.cmake =================================================================== RCS file: Modules/CMakeTestASM-GCCCompiler.cmake diff -N Modules/CMakeTestASM-GCCCompiler.cmake --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Modules/CMakeTestASM-GCCCompiler.cmake 8 Mar 2009 19:35:15 -0000 @@ -0,0 +1,10 @@ + +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that that selected ASM-ATT 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 "-GCC") +INCLUDE(CMakeTestASMCompiler) +SET(ASM_DIALECT) Index: Source/cmLocalUnixMakefileGenerator3.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v retrieving revision 1.262 diff -b -u -p -r1.262 cmLocalUnixMakefileGenerator3.cxx --- Source/cmLocalUnixMakefileGenerator3.cxx 24 Feb 2009 20:37:09 -0000 1.262 +++ Source/cmLocalUnixMakefileGenerator3.cxx 8 Mar 2009 19:35:17 -0000 @@ -1528,7 +1528,7 @@ cmLocalUnixMakefileGenerator3 // Create the scanner for this language cmDepends *scanner = 0; - if(lang == "C" || lang == "CXX" || lang == "RC") + if(lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM-GCC") { // TODO: Handle RC (resource files) dependencies correctly. scanner = new cmDependsC(this, targetDir, lang.c_str());
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake