Re: [CMake] Changing compiler

2011-04-21 Thread David Doria
 Sounds like you must have gotten errors when you built gcc...

 Pore through the log of what happened during the gcc build maybe?

 Are you building gcc from source, or using some package manager to build it
 for you? (MacPorts, something else?)


FYI - there was no problem all along with the build (see paragraph below):


 The executable 'gcc' never exists in the build directory even if the build
 is successful. It is called 'xgcc'. 'xgcc' will finally be renamed to 'gcc'
 as part of 'make install'. The reason for this naming convention is listed
 in the source file gcc/Makefile.in:

 # We call this executable `xgcc' rather than `gcc'
 # to avoid confusion if the current directory is in the path
 # and CC is `gcc'.  It is renamed to `gcc' when it is installed.

 BR,
 Andi


However, I'm still having trouble using it to build ITK. I tried two things:

1) I run
ccmake ~/src/ITK

Then before I configure, I change the CMAKE_C/CXX_COMPILER variables. Then
when I configure I get:

 You have changed variables that require your cache to be deleted.
 Configure will be re-run and you may have to reset some variables.
 The following variables have changed:
 CMAKE_C_COMPILER= /home/doriad/bin/gcc/gcc/xgcc
 CMAKE_CXX_COMPILER= /home/doriad/bin/gcc/gcc/g++


 CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52
 (MESSAGE):
   The C compiler /home/doriad/bin/gcc/gcc/xgcc is not able to compile a
   simple test program.

   It fails with the following output:

Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp

2) I run:
ccmake ../../src/ITK -DCMAKE_CXX_COMPILER=/home/doriad/bin/gcc/gcc/g++
-DCMAKE_C_COMPILER=/home/doriad/bin/gcc/gcc/xgcc

 CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52
 (MESSAGE):
   The C compiler /home/doriad/bin/gcc/gcc/xgcc is not able to compile a
   simple test program.

   It fails with the following output:

Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp



   Run Build Command:/usr/bin/gmake cmTryCompileExec/fast

   /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
   CMakeFiles/cmTryCompileExec.dir/build

   gmake[1]: Entering directory
   `/home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp'


Any thoughts?

Thanks,

David
___
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

Re: [CMake] Changing compiler

2011-04-21 Thread David Cole
On Thu, Apr 21, 2011 at 7:47 AM, David Doria daviddo...@gmail.com wrote:

 Sounds like you must have gotten errors when you built gcc...

 Pore through the log of what happened during the gcc build maybe?

 Are you building gcc from source, or using some package manager to build
 it for you? (MacPorts, something else?)


 FYI - there was no problem all along with the build (see paragraph below):


 The executable 'gcc' never exists in the build directory even if the build
 is successful. It is called 'xgcc'. 'xgcc' will finally be renamed to 'gcc'
 as part of 'make install'. The reason for this naming convention is listed
 in the source file gcc/Makefile.in:

 # We call this executable `xgcc' rather than `gcc'
 # to avoid confusion if the current directory is in the path
 # and CC is `gcc'.  It is renamed to `gcc' when it is installed.

 BR,
 Andi


 However, I'm still having trouble using it to build ITK. I tried two
 things:

 1) I run
 ccmake ~/src/ITK

 Then before I configure, I change the CMAKE_C/CXX_COMPILER variables. Then
 when I configure I get:

  You have changed variables that require your cache to be deleted.
  Configure will be re-run and you may have to reset some variables.
  The following variables have changed:
  CMAKE_C_COMPILER= /home/doriad/bin/gcc/gcc/xgcc
  CMAKE_CXX_COMPILER= /home/doriad/bin/gcc/gcc/g++


  CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52
  (MESSAGE):
The C compiler /home/doriad/bin/gcc/gcc/xgcc is not able to compile a

simple test program.

It fails with the following output:

 Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp

 2) I run:
 ccmake ../../src/ITK -DCMAKE_CXX_COMPILER=/home/doriad/bin/gcc/gcc/g++
 -DCMAKE_C_COMPILER=/home/doriad/bin/gcc/gcc/xgcc

  CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52
  (MESSAGE):
The C compiler /home/doriad/bin/gcc/gcc/xgcc is not able to compile a

simple test program.

It fails with the following output:

 Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp




Run Build Command:/usr/bin/gmake cmTryCompileExec/fast

/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build

gmake[1]: Entering directory
`/home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp'


 Any thoughts?

 Thanks,

 David



Can gcc run from its build tree? Or does it need to be installed to work?

I would try using a prefix and installing it somewhere other than its build
tree.
___
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

Re: [CMake] Changing compiler

2011-04-20 Thread David Cole
If you are setting the CXX compiler, you should also probably be setting the
C compiler.

I always use environment variables to do this:

  export CC=/home/doriad/src/gcc-4.5.2/bin/gcc/gcc
  export CXX=/home/doriad/src/gcc-4.5.2/bin/gcc/g++
  ccmake ../../src/ITK

If that still doesn't work, then inspect the contents of the file
CMakeFiles/CMakeError.log to see what the actual errors are, and post them
here. (CMakeFiles/CMakeOutput.log may also have relevant results in it...)


HTH,
David C.


On Wed, Apr 20, 2011 at 7:39 AM, David Doria daviddo...@gmail.com wrote:

 I am trying to build ITK with a non-system-standard compiler. I did so
 by running:

 ccmake ../../src/ITK/
 -DCMAKE_CXX_COMPILER=/home/doriad/src/gcc-4.5.2/bin/gcc/g++

 However, I get:

 ---
  CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:45
  (MESSAGE):
   The C++ compiler /home/doriad/src/gcc-4.5.2/bin/gcc/g++ is not able to
   compile a simple test program.

   It fails with the following output:

Change Dir: /home/doriad/bin/ITK/CMakeFiles/CMakeTmp



   Run Build Command:/usr/bin/gmake cmTryCompileExec/fast

   /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
   CMakeFiles/cmTryCompileExec.dir/build

   gmake[1]: Entering directory `/home/doriad/bin/ITK/CMakeFiles/CMakeTmp'

 ---

 This is indeed the correct path for the compiler:

 [doriad@daviddesktop ~]$ ~/src/gcc-4.5.2/bin/gcc/g++
 g++: no input files

 I tried creating a fresh build directory and nothing changed. Any
 suggestions of what else to do to use this compiler?

 Thanks,

 David
 ___
 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

___
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

Re: [CMake] Changing compiler

2011-04-20 Thread David Doria
On Wed, Apr 20, 2011 at 9:04 AM, David Cole david.c...@kitware.com wrote:
 If you are setting the CXX compiler, you should also probably be setting the
 C compiler.

 I always use environment variables to do this:

   export CC=/home/doriad/src/gcc-4.5.2/bin/gcc/gcc
   export CXX=/home/doriad/src/gcc-4.5.2/bin/gcc/g++
   ccmake ../../src/ITK

 If that still doesn't work, then inspect the contents of the file
 CMakeFiles/CMakeError.log to see what the actual errors are, and post them
 here. (CMakeFiles/CMakeOutput.log may also have relevant results in it...)


 HTH,
 David C.

Hm, so there is no 'gcc' executable after I built gcc. Gcc's configure
says: The following languages will be built:
c,c++,fortran,java,objc. So I'm assuming it should be there? I tried
setting the ITK C compiler to g++ as well, but no dice.

In CMakeFiles/CMakeError.log

of course it says:

CMakeCCompilerId.c:2:3: error: #error A C++ compiler has been selected for C.

The executables that were built are:

[doriad@daviddesktop gcc]$ find . -executable -type f
./as
./cc1-dummy
./jcf-dump
./cc1
./jvgenmain
./gcj
./config.status
./lto-wrapper
./cc1plus-dummy
./cc1plus
./cc1obj-dummy
./gcov
./nm
./cpp
./f951
./xgcc
./cc1obj
./gfortran
./collect2
./collect-ld
./jc1
./g++
./gcov-dump

Any thoughts?

Thanks,

David
___
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


Re: [CMake] Changing compiler

2011-04-20 Thread David Cole
On Wed, Apr 20, 2011 at 9:43 AM, David Doria daviddo...@gmail.com wrote:

 On Wed, Apr 20, 2011 at 9:04 AM, David Cole david.c...@kitware.com
 wrote:
  If you are setting the CXX compiler, you should also probably be setting
 the
  C compiler.
 
  I always use environment variables to do this:
 
export CC=/home/doriad/src/gcc-4.5.2/bin/gcc/gcc
export CXX=/home/doriad/src/gcc-4.5.2/bin/gcc/g++
ccmake ../../src/ITK
 
  If that still doesn't work, then inspect the contents of the file
  CMakeFiles/CMakeError.log to see what the actual errors are, and post
 them
  here. (CMakeFiles/CMakeOutput.log may also have relevant results in
 it...)
 
 
  HTH,
  David C.

 Hm, so there is no 'gcc' executable after I built gcc. Gcc's configure
 says: The following languages will be built:
 c,c++,fortran,java,objc. So I'm assuming it should be there? I tried
 setting the ITK C compiler to g++ as well, but no dice.

 In CMakeFiles/CMakeError.log

 of course it says:

 CMakeCCompilerId.c:2:3: error: #error A C++ compiler has been selected for
 C.

 The executables that were built are:

 [doriad@daviddesktop gcc]$ find . -executable -type f
 ./as
 ./cc1-dummy
 ./jcf-dump
 ./cc1
 ./jvgenmain
 ./gcj
 ./config.status
 ./lto-wrapper
 ./cc1plus-dummy
 ./cc1plus
 ./cc1obj-dummy
 ./gcov
 ./nm
 ./cpp
 ./f951
 ./xgcc
 ./cc1obj
 ./gfortran
 ./collect2
 ./collect-ld
 ./jc1
 ./g++
 ./gcov-dump

 Any thoughts?

 Thanks,

 David



Sounds like you must have gotten errors when you built gcc...

Pore through the log of what happened during the gcc build maybe?

Are you building gcc from source, or using some package manager to build it
for you? (MacPorts, something else?)
___
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

Re: [CMake] Changing compiler flags generated by cmake

2010-06-22 Thread Tyler Roscoe
On Tue, Jun 22, 2010 at 08:30:43PM -0700, ben scott wrote:
 I know about the variable to add custom flags for g++, but how do I get rid 
 if 
 unwanted flags? I am  writing a program for KDE on Linux and cmake insists on 

Something like:

string(REPLACE -ansi  CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
___
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


Re: [CMake] Changing compiler at runtime

2007-11-24 Thread Brandon Van Every
On Nov 25, 2007 2:12 AM, Gonzalo Garramuño [EMAIL PROTECTED] wrote:

 Recently, Josef Karthauser was requesting the ability to change the
 compiler at runtime.

 I am now more or less seconding that request or asking for workarounds.

 The situation:
 I have a complex project built for windows that has several plug-ins
 that, for each version of the project, needs to be compiled with a
 particular compiler version to keep binary compatibility.  Thus, my v3.0
 needs to be built against vc6, my v4.0 against vc7.1, my v5.0 against
 vc8, etc.
 I am automating the build process for each build as an out of source
 build, but I also need to automate the changing of the compiler.

I don't get it.  Why do you need to resolve any of this at runtime?
Resolve it 5 times at configuration time, run 5 different
configurations.  It would be 10 lines in your favorite scripting
language.  Could invoke with cmake -P mybuildscript if you don't
mind CMake script and don't want another language dependency.


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake