On 24. Aug, 2009, at 19:38, 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. Thus, I want to have the C+ + compiler driver compile the top-level file; the compiler driver would first preprocess the include directives and then invoke the assembler on the resulting translation unit.


Why don't you do this:

set(ASM_SRCS bar.S)
add_library(test SHARED foo.cpp ${ASM_SRCS})
set_source_files_properties(${ASM_SRCS} PROPERTIES
  LANGUAGE C
  )

This will get CMake to treat the ASM files as C files and just pass them to the C-compiler, which in turn will preprocess them. I know this works with gcc, I'm not sure whether this will work with anything else.

Michael

_______________________________________________
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

Reply via email to