Compiler Option - different option per code file

General questions regarding the usage of CodeLite
doublec
CodeLite Curious
Posts: 1
Joined: Mon May 01, 2017 5:43 pm
Genuine User: Yes
IDE Question: c++
Contact:

Compiler Option - different option per code file

Post by doublec »

Using: Codelite version 10.0.0 : not self compiled : Windows 7 : gcc 5.1.0

I am new to codelite, I am working on a simple test project that creates a .dll and an .exe that uses the .dll.

Two files: add.c and addtest.c, The first file is compiled as .dll the second as .exe

I would like to setting different compiler options for each .c file.
I found how to set the option at the project level but not a way to set option at the file level.

I guess one way is to set the project option for the .dll once that's done change projects/options and compile .exe

Thanks,
doublec
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compiler Option - different option per code file

Post by eranif »

You can't set options per file in CodeLite. You could use a custom makefile which you create where you can setup whatever you want
Make sure you have read the HOW TO POST thread
Gibbon1
CodeLite Expert
Posts: 167
Joined: Fri Jul 22, 2011 5:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compiler Option - different option per code file

Post by Gibbon1 »

Maybe useful or not but changing the compiler options in settings doesn't force a rebuild.

I use this sometimes to compile one file with optimizations turned off -o0 (since I do embedded firmware turning off optimizations for the entire program means it won't fit in flash)
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compiler Option - different option per code file

Post by eranif »

You control the optimization from the code like this:

Code: Select all

#pragma GCC push_options
#pragma GCC optimize ("O0")

your code

#pragma GCC pop_options
Make sure you have read the HOW TO POST thread
Post Reply