Author Topic: how to customize the compiler for different projects?  (Read 2011 times)

Offline yaoyansi

  • Multiple posting newcomer
  • *
  • Posts: 31
how to customize the compiler for different projects?
« on: September 01, 2014, 11:25:02 pm »
Hi all,
For some reason, I have to use gcc4.1.2 as the compiler for my project M in my CentOS7.
I built gcc4.1.2 in my CentOS7, here is the configuration and make scripts:
Code: [Select]
../src/configure --prefix=/opt/gcc412 --program-suffix=412 --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --enable-__cxa_atexit

make -j 2 bootstrap
so, the output is gcc412, g++412 and they are installed into the same directory with gcc and g++.

and I'm trying to find out how to set gcc412 and g++412 as the compiler for the .c/.cpp files in my project M.
I think I can achieve it in this way:
Setting>Compiler>Global Compiler Settings>Toolchain executables>Program Files:
C Compiler: gcc412
C++ Compiler: g++412
Linker for dynamic libs: g++412

But the problem is that I have to change these settings back if I want to use another project A. Project A uses gcc instead of gcc412.
So is there any convenient way to switch from project M and A? I don't want to change these settings each time when I switch the projects.

I read this page: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system,
But I can't find the GUI in the following image.

Where is this window in C::B?

Cheers
yaoyansi

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: how to customize the compiler for different projects?
« Reply #1 on: September 01, 2014, 11:29:55 pm »
Create a second compiler set (click "Copy" in the compiler settings)  and name it appropriately.
You can have two or more compilers in one project, just create different targets for them ("Project -> Properties -> Build targets").