[OpendTect_Developers] R: R: CMake Help

Kristofer Tingdahl kristofer.tingdahl at dgbes.com
Tue Jul 24 16:41:47 CEST 2012


Dear David,

The easiest way to do this is to hook up to our flag, which is
__debug__. Hence, your c-file (or header-file) would look something
like:

#ifdef __debug__

define whatever you want

#endif


Best regards,

Kristofer Tingdahl


On Tue, Jul 17, 2012 at 10:29 PM, David Epelboim <david at geoinfo.com.ar> wrote:
> Kris,
>
> I have one more question here.
>
> I want to add a preprocessor definition as -DMY_DEBUG in Linux or MY_DEBUG
> in Windows, when the project is configured for DEBUG only.
>
> I have tried this
>
> #ifdef DEBUG
> ADD_DEFINITIONS(-DCLAS_DEBUG)
> #endif
>
> But it makes CLAS_DEBUG appear in both Debug and Release.
>
> Do you have a hint for us?
>
> Thanks!
>
> David.
>
>
>
>
> Kristofer Tingdahl wrote, On 7/10/2012 12:04:
>
> David and Antonio,
>
>
> On Tue, Jul 10, 2012 at 1:46 PM, David Epelboim <david at geoinfo.com.ar>
> wrote:
>>
>> Kris,
>>
>> Jumping into Antonio's bandwagon, are there ways to add an Object file
>> instead? .o or .obj...
>
>
> you can add .o or .obj files using the OD_MODULE_SOURCES variable, in the
> same way as you add .c or .cc files. If CMake finds an obj-file in the list,
> it will simply include it in the shared library.
>
> You can however not add static libraries directly, they have to be unpacked.
> You can either do that yourself, or you could let our cmake script do it for
> you.
>
>> thank you for your prompt response. As I remarked, one problem I had with
>> pmake mkshobjlib was precisely that it used to unpack libraries and link
>> plugins object files + library unpacked object files.
>>
>> This approach fails for quite large (static) libraries (the link command
>> is too long to fit shell buffers), depending on the number of libraries and
>> object files contained in each library: letting the linker create a .so file
>> adding the –Lmylib directives works and does not need to unpack libmylib.a.
>
>
> I can see that there may be a problem if you have extremely large shared
> libraries. We have a one internally with more than 300 files, and that works
> flawlessly. The link-command under cmake is not put on the commandprompt,
> but is stored in a file (CMakeFiles/<target>/link.txt) Perhaps that does a
> difference.
>
>
> Best regards,
>
>
> Kristofer Tingdahl
>
> --
> Kristofer Tingdahl, Ph. D.
> CEO
> dGB Earth Sciences
> http://www.dgbes.com
>
>
>



-- 
Kristofer Tingdahl, Ph. D.
CEO
dGB Earth Sciences
http://www.dgbes.com




More information about the Developers mailing list