Hi Alex,<br><br>I&#39;ve tested your zip file example and it works as expected: the -I options are present but not the -D options.  After some more testing of what is different in my setup I think I have isolated the cause.  If I change this one line in your example from this:<br>
<br>    add_definitions(-DFOO)<br><br>to this:<br><br>    add_definitions(&quot;-DFOO -DBAR&quot;)<br><br>then I get  the same behaviour I was seeing before: the -DFOO -DBAR options are passed through to the assembler command line.  I see from the documentation that I should really be using add_definitions(-DFOO -DBAR) without the double quotes but they were harmless before.  Should I file this as a bug - or will it just be marked as &quot;not a bug&quot;, i.e. don&#39;t use double quotes like that with add_definitions ?<br>
<br>--<br>Glenn<br><br><br><div class="gmail_quote">2011/8/3 Alexander Neundorf <span dir="ltr">&lt;<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<div><div></div><div class="h5"><br>
On Wednesday 03 August 2011, Glenn Coombs wrote:<br>
&gt; I tried changing from ASM to ASM-ATT and that fails like this:<br>
&gt;<br>
&gt; /usr/bin/as  -I/user/grc/msvdx-cvsfiles/sim/msvdx-cmake-2.8.5/systemC/src<br>
&gt; -I/user/grc/msvdx-cvsfiles/sim/msvdx-cmake-2.8.5/systemC/src/sysc/kernel<br>
&gt; -DNOMINMAX -DUSE_SIM_NAMESPACE -o<br>
&gt; CMakeFiles/systemc.dir/src/sysc/qt/md/i386.s.o<br>
&gt; /user/grc/msvdx-cvsfiles/sim/msvdx-cmake-2.8.5/systemC/src/sysc/qt/md/i386.<br>
&gt; s /usr/bin/as: unrecognized option `-NOMINMAX&#39;<br>
&gt;<br>
&gt; I really don&#39;t think the -I and -D options should be passed through for<br>
&gt; assembler files.  They only make sense for C/C++ files.  There should be a<br>
&gt; separate variable like CMAKE_ASM_FLAGS that is used instead of<br>
&gt; CMAKE_C_FLAGS or CMAKE_CXX_FLAGS.  And maybe there needs to be a change to<br>
&gt; the<br>
&gt; add_definitions() command to allow an optional LANG argument ?  Do<br>
&gt; assembers even support preprocessor definitions ?<br>
&gt;<br>
&gt; I was able to get it to work for both 2.8.4 and 2.8.5 with the following<br>
&gt; code:<br>
&gt;<br>
&gt; if(UNIX)<br>
&gt;     list(APPEND sources &quot;src/sysc/qt/qt.c&quot;)<br>
&gt;<br>
&gt;     # see if we are building 32-bit or 64-bit executables<br>
&gt;     file(WRITE ${CMAKE_BINARY_DIR}/check_32or64bit.cpp &quot;int main(int argc,<br>
&gt; char *argv[]) { return 8 * sizeof(char *); }\n&quot;)<br>
&gt;<br>
&gt;     try_run(<br>
&gt;         run_result<br>
&gt;         compile_result<br>
&gt;         ${CMAKE_BINARY_DIR}<br>
&gt; ${CMAKE_BINARY_DIR}/check_32or64bit.cpp<br>
&gt;         )<br>
&gt;<br>
&gt;     if (${run_result} EQUAL 32)<br>
&gt;         list(APPEND sources &quot;src/sysc/qt/md/i386.s&quot;)<br>
&gt;         if(APPLE)<br>
&gt;             set(ASM_SYS_FLAGS &quot;-arch i386&quot;)<br>
&gt;         else()<br>
&gt;             set(ASM_SYS_FLAGS &quot;-32&quot;)<br>
&gt;         endif()<br>
&gt;     else()<br>
&gt;         list(APPEND sources &quot;src/sysc/qt/md/iX86_64.s&quot;)<br>
&gt;         if(APPLE)<br>
&gt;             set(ASM_SYS_FLAGS &quot;-arch x86_64&quot;)<br>
&gt;         else()<br>
&gt;             set(ASM_SYS_FLAGS &quot;-64&quot;)<br>
&gt;         endif()<br>
&gt;     endif()<br>
&gt;<br>
&gt;     enable_language(ASM-ATT)<br>
&gt;<br>
&gt;     set(CMAKE_ASM-ATT_COMPILE_OBJECT &quot;&lt;CMAKE_ASM-ATT_COMPILER&gt;<br>
&gt; ${ASM_SYS_FLAGS} -o &lt;OBJECT&gt; &lt;SOURCE&gt;&quot;)<br>
&gt; endif()<br>
&gt;<br>
&gt; I&#39;m not sure if this is the recommended way to do this though.  I thought<br>
&gt; the documentation said to override CMAKE_ASM-ATT_COMPILE_OBJECT before the<br>
&gt; enable_language() command.<br>
<br>
</div></div>You should not have to override it.<br>
To set flags, there are for every enabled language CMAKE_&lt;LANGUAGE&gt;_FLAGS in<br>
the cmake cache, i.e. CMAKE_ASM-ATT_FLAGS in this case.<br>
<br>
I tried to reproduce the problem with the attached tiny project, and I don&#39;t<br>
get the problem you describe. This is the output:<br>
<br>
as-test/b$ /opt/cmake-HEAD/bin/cmake ..<br>
-- The C compiler identification is GNU<br>
-- The CXX compiler identification is GNU<br>
-- Check for working C compiler: /usr/bin/gcc<br>
-- Check for working C compiler: /usr/bin/gcc -- works<br>
-- Detecting C compiler ABI info<br>
-- Detecting C compiler ABI info - done<br>
-- Check for working CXX compiler: /usr/bin/c++<br>
-- Check for working CXX compiler: /usr/bin/c++ -- works<br>
-- Detecting CXX compiler ABI info<br>
-- Detecting CXX compiler ABI info - done<br>
-- The ASM-ATT compiler identification is GNU<br>
-- Found assembler: /usr/bin/as<br>
-- Configuring done<br>
-- Generating done<br>
-- Build files have been written to: /home/alex/src/CMake/build dir/CMake-<br>
git/Tests/Assembler/as-test/b<br>
as-test/b$ make VERBOSE=1<br>
...<br>
Scanning dependencies of target hello<br>
make[2]: Leaving directory `/home/alex/src/CMake/build dir/CMake-<br>
git/Tests/Assembler/as-test/b&#39;<br>
make -f CMakeFiles/hello.dir/build.make CMakeFiles/hello.dir/build<br>
make[2]: Entering directory `/home/alex/src/CMake/build dir/CMake-<br>
git/Tests/Assembler/as-test/b&#39;<br>
/opt/cmake-HEAD/bin/cmake -E cmake_progress_report &quot;/home/alex/src/CMake/build<br>
dir/CMake-git/Tests/Assembler/as-test/b/CMakeFiles&quot; 1<br>
<br>
[ 50%] Building C object CMakeFiles/hello.dir/main.c.o<br>
/usr/bin/gcc  -DFOO -DBLUB=blub -DBAR=bar -I/opt/include    -o<br>
CMakeFiles/hello.dir/main.c.o   -c &quot;/home/alex/src/CMake/build dir/CMake-<br>
git/Tests/Assembler/as-test/main.c&quot;<br>
/opt/cmake-HEAD/bin/cmake -E cmake_progress_report &quot;/home/alex/src/CMake/build<br>
dir/CMake-git/Tests/Assembler/as-test/b/CMakeFiles&quot; 2<br>
<br>
[100%] Building ASM-ATT object CMakeFiles/hello.dir/foo.s.o<br>
/usr/bin/as  -I/opt/include    -o CMakeFiles/hello.dir/foo.s.o<br>
&quot;/home/alex/src/CMake/build dir/CMake-git/Tests/Assembler/as-test/foo.s&quot;<br>
Linking C executable hello<br>
...<br>
<br>
<br>
So, here main.c gets all the -D&#39;s, and foo.s gets the -I, but not the -D&#39;s.<br>
Is that different for you ?<br>
<br>
Alex<br>
</blockquote></div><br>