Re: [CMake] find_package() for static only / shared only

2018-03-23 Thread Mario Emmenlauer
Two thumbs up for this! :-) On 23.03.2018 03:14, Ray Donnelly wrote: > Our why doesn't cmake set a long needed standard here of .dll.lib and be done > with this nonsense? > > On Thu, Mar 22, 2018, 11:58 PM P F via CMake > wrote: > > Why not

Re: [CMake] find_package() for static only / shared only

2018-03-23 Thread Mario Emmenlauer
Dear PF, thanks! I think this is a quite sensible approach and I will do as you suggest. I did not consider it at first because there are some packages that can install static and shared side-by-side. But I agree that your suggestion is ore pragmatic and also less error-prone. All the best,

Re: [CMake] find_package() for static only / shared only

2018-03-22 Thread Ray Donnelly
Our why doesn't cmake set a long needed standard here of .dll.lib and be done with this nonsense? On Thu, Mar 22, 2018, 11:58 PM P F via CMake wrote: > Why not install shared libraries in one location and static libraries in > another? > > > On Mar 21, 2018, at 4:55 AM, Mario

Re: [CMake] find_package() for static only / shared only

2018-03-22 Thread P F via CMake
Why not install shared libraries in one location and static libraries in another? > On Mar 21, 2018, at 4:55 AM, Mario Emmenlauer wrote: > > > I've googled this issue for a while now but found only few > references (1,2) and no solution. I'd like to enforce that >

Re: [CMake] find_package() for static only / shared only

2018-03-22 Thread CHEVRIER, Marc
Yes. Seems OK. For Windows, if libraries are all your owns, you can manage this by relaying on a specific prefix for static libraries. A commonly adopted naming is to add prefix "lib" for static libraries. Now, if you add to rely on external libraries, I don't see any general solution. On

Re: [CMake] find_package() for static only / shared only

2018-03-22 Thread Mario Emmenlauer
Dear Marc, this is a pretty neat idea! Let me quickly recapitulate: the library prefixes and suffixes for multiple platforms are: | static| shared | prefix|suffix| prefix| suffix

Re: [CMake] find_package() for static only / shared only

2018-03-22 Thread CHEVRIER, Marc
Another possibility is to customize the variable CMAKE_FIND_LIBRARY_SUFFIXES. For example, on linux: * shared only: set (CMAKE_FIND_LIBRARY_SUFFIXES ".so") * static only: set (CMAKE_FIND_LIBRARY_SUFFIXES ".a") On Windows, it is more problematic because static and "import" shared libraries have

[CMake] find_package() for static only / shared only

2018-03-21 Thread Mario Emmenlauer
I've googled this issue for a while now but found only few references (1,2) and no solution. I'd like to enforce that find_package() will only accept static or shared libraries. I would then set this option based on BUILD_SHARED_LIBS=(ON|OFF). I.e. I'd love to have something like: