Page 1 of 1

Precompiled header with CMake

PostPosted: Fri Apr 13, 2012 7:34 pm
by talnicolas
The project in which we are using QxOrm doesn't have any .pro file. It is using CMake generating a VS10 project.
Would be possible to have an example that shows how to use correctly precompiled.h using CMake?
(until now I was just adding the include in the header files, I want now to use it the correct way)

Thanks.

Re: Precompiled header with CMake

PostPosted: Sat Apr 14, 2012 10:15 am
by QxOrm admin
Hi,

It is using CMake generating a VS10 project.
Would be possible to have an example that shows how to use correctly precompiled.h using CMake?

I don't know CMake at all, so I can't help you for CMake, sorry.
MSVC2008, MSVC2010 and GCC supports precompiled headers, so there is no reason that CMake doesn't support it !
You should try to find a CMake FAQ or other resources about CMake on the web...

until now I was just adding the include in the header files

It's a very bad thing !!!
Using precompiled header or not, your source code doesn't have to change (without precompiled header support, compilation time will increase, but this is the same source code).
To use precompiled header correctly, it is very simple :
* doesn't include a precompiled header into an include file (never) ;
* into each *.cpp files, the first include must be the precompiled header file.