[CMake] How to correctly default initialize CMAKE_BUILD_TYPE inside CMakeLists.txt

2019-01-14 Thread Kim Walisch
Hi, By default I would like to set CMAKE_BUILD_TYPE=Release (inside CMakeLists.txt) if the user has not defined CMAKE_BUILD_TYPE himself (e.g. as command-line option: cmake . -DCMAKE_BUILD_TYPE=Debug). Is there a best practice how to do this in CMake? I have been searching the web to see how other

[CMake] target_compile_features() uses incorrect C++ version

2018-12-05 Thread Kim Walisch
however expect that if the default C++ version of the compiler is > C++11 CMake would not add -std=gnu++11 to the compiler flags. For me this is a CMake bug. Thanks, Kim Walisch -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/W

Re: [CMake] Warning when building static & shared library (DLL) on Windows

2018-09-30 Thread Kim Walisch
Thanks! On Sun, Sep 30, 2018 at 12:41 PM J Decker wrote: > > > On Sun, Sep 30, 2018 at 3:12 AM Kim Walisch wrote: > >> Hi, >> >> I have recently found out about CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS which >> allows >> to easily build a shared library i.e. D

[CMake] Warning when building static & shared library (DLL) on Windows

2018-09-30 Thread Kim Walisch
Hi, I have recently found out about CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS which allows to easily build a shared library i.e. DLL on Windows. It works great and it is an awesome feature however I have run into a warning on Windows (using cmake, ninja, MSVC) because my CMakeLists.txt builds both a static

Re: [CMake] Linking programs with Clang & OpenMP fails

2018-05-04 Thread Kim Walisch
ing as GCC does not require linking against libatomic. Regards, Kim On Fri, May 4, 2018 at 7:48 PM, Kim Walisch wrote: > Hi, > > The latest Clang-6.0 compiler finally enables OpenMP by default on > Linux (e.g. Ubuntu-18 x86_64). > > But OpenMP programs using Clang-6.0/CMake

[CMake] Linking programs with Clang & OpenMP fails

2018-05-04 Thread Kim Walisch
Hi, The latest Clang-6.0 compiler finally enables OpenMP by default on Linux (e.g. Ubuntu-18 x86_64). But OpenMP programs using Clang-6.0/CMake-3.10 fail to compile: [100%] Linking CXX executable primecount libprimecount.a(P2.cpp.o): In function `.omp_outlined..7': P2.cpp:(.text+0x2194): undefin

[CMake] find_package(): fails because static library is not installed

2018-02-15 Thread Kim Walisch
Hi, I have added support for find_package(primesieve) to my primesieve library and I have exported 2 targets in my main CMakeLists.txt: primesieve::libprimesieve (shared library) primesieve::libprimesieve-static It works fine if both the static and shared primesieve libraries have previously bee

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
Thanks for your comment, I seem to have misunderstood the usage of BUILD_SHARED_LIBS. I will remove the hack to serve either a static or shared libprimesieve from my cmake config file. Kim On Feb 14, 2018 11:42 PM, "Hendrik Sattler" wrote: > > > Am 14. Februar 2018 21:47

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
make-developers/2017-June/030115.html It would be really nice though if CMake would support library aliases for import targets, then I could achieve the same using much nicer code. Kim On Wed, Feb 14, 2018 at 7:08 PM, Kim Walisch wrote: > CMake currently does not allow alias libraries for

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
/command/add_library.html#alias-libraries > > if (BUILD_SHARED_LIBS) > add_library(my_libprimesieve ALIAS libprimesieve) > else > add_library(my_libprimesieve ALIAS libprimesieve-static) > endif(BUILD_SHARED_LIBS) > > Then, set it properly to Primesieve::Primesiev

[CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
Hi, My primesieve project builds as both a static and a shared library, hence there are 2 targets in my main CMakeLists.txt: 1) libprimesieve (shared library) 2) libprimesieve-static I am now trying to add support for find_package(Primesieve). Ideally I would like that users can link against lib

[CMake] cmake treat warnings as errors

2017-03-11 Thread Kim Walisch
Hi, Obviously the return code of cmake is 1 if any error occurs. For integration testing I would like the return code of cmake to be 1 as well if any warning occurs (during configuration). Is there an option for this? -- Powered by www.kitware.com Please keep messages on-topic and check the CM