Re: [CMake] Proper way to export a library

2013-11-04 Thread Matthew Woehlke
On 2013-11-02 13:38, Cyrille Faucheux wrote: [...] from what I understood from Matthew first answer ("implicit compile flags [...] for imported tagets"), I was under the impression that I could get MYPROJECT_STATIC automatically defined when linking another program against a static version of my

Re: [CMake] Proper way to export a library

2013-11-02 Thread Cyrille Faucheux
Wow, this thread has gone wild... To clarify my case: The prototype of each functions I want to export is prefixed by a MYPROJECT_EXTERNAL preprocessor constant. With Visual Studio, this constant is, by default, set to __declspec(dllimport). This way, I can link against the shared version of this

Re: [CMake] Proper way to export a library

2013-10-31 Thread David Cole
Microsoft believed in hidden by default for shared libraries. Don't say things like this: people will never hide anything ever again... ;-) But seriously, making only those things public that are explicitly exported has some major benefits: for one, it minimizes the probability of clashes w

Re: [CMake] Proper way to export a library

2013-10-31 Thread Mateusz Loskot
On 31 October 2013 20:21, Hendrik Sattler wrote: > > Giordano Khouri schrieb: >>I am a firm believer that static libraries should have hidden >>visibility. This is based on my experience on the Mac and may be >>different in Linux. > > This is about Windows, not Linux or Mac. Linking libraries wor

Re: [CMake] Proper way to export a library

2013-10-31 Thread J Decker
- >>> From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On >>> Behalf Of J Decker >>> Sent: Thursday, October 31, 2013 3:27 PM >>> To: Hendrik Sattler >>> Cc: Matthew Woehlke; cmake@cmake.org >>> Subject: Re: [CMake] Proper w

Re: [CMake] Proper way to export a library

2013-10-31 Thread Hendrik Sattler
ed into an executable. > >> -Original Message- >> From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On >> Behalf Of J Decker >> Sent: Thursday, October 31, 2013 3:27 PM >> To: Hendrik Sattler >> Cc: Matthew Woehlke; cmake@cmake.org >> Sub

Re: [CMake] Proper way to export a library

2013-10-31 Thread Giordano Khouri
sday, October 31, 2013 3:27 PM > To: Hendrik Sattler > Cc: Matthew Woehlke; cmake@cmake.org > Subject: Re: [CMake] Proper way to export a library > > something like (but probably mostly in a common header) > > if( IS_THIS_PROJECT ) > if( UNIX or STATIC ) > set

Re: [CMake] Proper way to export a library

2013-10-31 Thread Matthew Woehlke
On 2013-10-31 14:46, Hendrik Sattler wrote: Matthew Woehlke schrieb: On 2013-10-31 05:26, Cyrille Faucheux wrote: On the library I'm currently working on, with Visual Studio, I have to declare some compile definition in order to get the proper "__declspec(dllimport)" or "__declspec(dllexport)"

Re: [CMake] Proper way to export a library

2013-10-31 Thread J Decker
something like (but probably mostly in a common header) if( IS_THIS_PROJECT ) if( UNIX or STATIC ) set( EXPORT ) # nothing, everything is exported by default; gcc/unix else( UNIX or STATIC ) set( EXPORT __declspec(dllexport) ) endif( UNIX or STATIC ) else( IS_THIS_PROJECT )

Re: [CMake] Proper way to export a library

2013-10-31 Thread Hendrik Sattler
Matthew Woehlke schrieb: >On 2013-10-31 05:26, Cyrille Faucheux wrote: >> Can you tell me a bit more about "implicit compile flags [...] for >imported >> tagets"? > >See documentation on target_compile_definitions. > >> On the library I'm currently working on, with Visual Studio, I have >to >> d

Re: [CMake] Proper way to export a library

2013-10-31 Thread Stephen Kelly
Cyrille Faucheux wrote: > Ok, great. > > Can you tell me a bit more about "implicit compile flags [...] for > imported tagets"? > > On the library I'm currently working on, with Visual Studio, I have to > declare some compile definition in order to get the proper > "__declspec(dllimport)" or "__

Re: [CMake] Proper way to export a library

2013-10-31 Thread Matthew Woehlke
On 2013-10-31 05:26, Cyrille Faucheux wrote: Can you tell me a bit more about "implicit compile flags [...] for imported tagets"? See documentation on target_compile_definitions. On the library I'm currently working on, with Visual Studio, I have to declare some compile definition in order to

Re: [CMake] Proper way to export a library

2013-10-31 Thread Cyrille Faucheux
Ok, great. Can you tell me a bit more about "implicit compile flags [...] for imported tagets"? On the library I'm currently working on, with Visual Studio, I have to declare some compile definition in order to get the proper "__declspec(dllimport)" or "__declspec(dllexport)" defined (or not defi

Re: [CMake] Proper way to export a library

2013-10-30 Thread Matthew Woehlke
On 2013-10-30 13:56, Cyrille Faucheux wrote: I'm trying to learn how to properly import/export librairies with CMake. I think I've read somewhere that the proper way to export libraries is through the module mode (as described in [1]), but: a) I can't find back where I've read that, b) Lots of l

[CMake] Proper way to export a library

2013-10-30 Thread Cyrille Faucheux
Hi, I'm trying to learn how to properly import/export librairies with CMake. I think I've read somewhere that the proper way to export libraries is through the module mode (as described in [1]), but: a) I can't find back where I've read that, b) Lots of libraries are still using the module mode (