Re: [CMake] Using generator expression with add_library

2019-11-07 Thread Andrew Fuller
whether to generate a static or shared lib. From: CMake on behalf of David Aldrich Sent: November 7, 2019 3:52 AM To: Petr Kmoch Cc: CMake MailingList Subject: Re: [CMake] Using generator expression with add_library Thank you. So I guess I can make

Re: [CMake] Using generator expression with add_library

2019-11-07 Thread David Aldrich
Thank you. So I guess I can make it as simple as: if(MSVC) add_library(${_star_lib_name} STATIC "") else() add_library(${_star_lib_name} SHARED "") endif() I just wondered if there was a more elegant way. On Thu, Nov 7, 2019 at 11:45 AM Petr Kmoch wrote: > Hi. > > The argument STATIC

Re: [CMake] Using generator expression with add_library

2019-11-07 Thread Petr Kmoch
Hi. The argument STATIC or SHARED is processed at CMake configure time (that is, when CMake is executing the add_library() command). However, generator expressions are only evaluated at generate time, which comes only after all CMake code is processed. Fortunately for you, compiler ID is

[CMake] Using generator expression with add_library

2019-11-07 Thread David Aldrich
I want to build a shared library for Linux and a static library for Windows. So I have tried: set (_star_lib_name "StdStars") add_library(${_star_lib_name} $<$:SHARED> $<$:STATIC> "" ) but that gives me error: CMake Error at