[CMake] Setting the compiler
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Fri Jul 27 15:32:45 EDT 2007
On 2007-07-27 14:09-0500 Juan Sanchez wrote:
> I'm evaluating CMAKE for use by our group and I am running into an issue
> with selecting the compiler.
>
> Is there any way to set the compiler and flags in the CMakeLists.txt
> file? This information appears to be ignored. The FAQ as well as the
> book suggest setting environment variables.
>
> We have a script which we can use to determine the platform we are on,
> but setting CMAKE_CXX_COMPILER in the if block of the CMakeLists.txt is
> ignored.
If you are using ENABLE_LANGUAGE, then you may be a victim of bug 4772 where
I give some simple demonstrations of how C or C++ flags are not set properly
if either language is enabled with ENABLE_LANGUAGE. Until this bug is
fixed, the only way currently to get complete language support is to avoid
using ENABLE_LANGUAGE. Instead, specify the language in the PROJECT command
by using, e.g.,
PROJECT(test)
which by default gives proper language support for C and C++.
Alternatively, if you want non-default languages supported then
use, e.g.,
Project(test C Fortran)
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the CMake
mailing list