Page 1 of 1

Compiler Option - different option per code file

Posted: Mon May 01, 2017 6:08 pm
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

Re: Compiler Option - different option per code file

Posted: Mon May 01, 2017 8:26 pm
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

Re: Compiler Option - different option per code file

Posted: Fri Jun 02, 2017 11:38 pm
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)

Re: Compiler Option - different option per code file

Posted: Sat Jun 03, 2017 9:12 am
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