[CMake] Passing -B on linux

Juan Sanchez Juan.Sanchez at amd.com
Thu Aug 2 12:31:07 EDT 2007


Hello gga,

Unfortunately, the ADD_DEFINITIONS aren't being used in the initial
tests being done by cmake.  What I've found is that I need to put the
location of the 64bit linker utils needed by g++ in my PATH.  In this
instance, its calling the wrong assembler.  The assembler is implicitly
called by g++ and -B would allow me to set the path.


Building CXX object CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.o
/.package/gcc-3.4.0/bin/g++    -o
CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.o -c
/test/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
/tmp/ccRjnwzu.s: Assembler messages:
/tmp/ccRjnwzu.s:8: Error: suffix or operands invalid for `push'
/tmp/ccRjnwzu.s:10: Error: suffix or operands invalid for `movq'
gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.o] Error 1
gmake[1]: Leaving directory `/test/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec/fast] Error 2


Is there any way to pass a flag to g++ being invoked by the testing
utils?  I'm at least able to put the c++ compiler specification in a
cache file, but I need to know how to prevent the path to the linker
utils to be at the whim of the developer's environment.

Regards,

Juan

gga wrote:
> Juan Sanchez wrote:
>> When I create a new cmake area, the tests are failing since it cannot
>> find the 64bit version of our tools on linux.
>>
> 
> Assuming they are installed in /usr/local or /usr, one should expect
> that to be automatic. That being said...
> 
>> Is there anyway to pass the -B option to C and C++ compiler during the
>> compiler testing phase?
>>
> 
> Yes.  ADD_DEFINITIONS() can be used to pass any flag to both compiler
> and linker.
> 
> For more granularity, you can use:
> SET_SOURCE_FILES_PROPERTIES with the COMPILE_FLAGS property.
> SET_TARGET_PROPERTIES with the LINK_FLAGS property.
> 
> Needless to say, a flag like -B will not be portable across compilers,
> so you'll need to check for the compiler you are using.
> 


-- 
Juan Sanchez
Juan.Sanchez at amd.com
800-538-8450 Ext. 54395
512-602-4395




More information about the CMake mailing list