[CMake] how to link a test with library in build directory, not with installed version?

2019-05-27 Thread Joachim Wuttke
How to link a test with a library as obtained in the build directory, not with the installed version, which may be outdated? Disclosure: cross-posted from https://stackoverflow.com/questions/56328326. == Use case == Suppose cmake; make; ctest; make install works fine: - generates libA, -

[CMake] conflict between configure & build steps in gitlab-runner script for Windows: Debug or Release build directory not found

2019-03-22 Thread Joachim Wuttke
A gitlab-runner configuration script .gitlab-ci.yml, for execution in the Powershell: === windows: tags: - windows stage: build script: - New-Item -ItemType "directory" -Confirm:$false -Force:$true -Name "build" - cd build - cmd.exe "C:\Program Files (x86)\Microsoft Visual

[cmake-developers] execute_process: how to detect TIMEOUT

2019-03-20 Thread Joachim Wuttke
The command execute_process has an option TIMEOUT. This option would be even more useful if one would notice when a timeout happened. Is there a way to tell from any of the outcome variables whether the process ran into timeout? - Joachim smime.p7s Description: S/MIME Cryptographic Signature

Re: [cmake-developers] Shared library under Windows and CMake: DLL not found before installation

2019-02-06 Thread Joachim Wuttke
Add code like this at the top of your project: ``` set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) ``` And combine it with ``` link_directories(BEFORE ${PROJECT_BINARY_DIR}/bin) ``` so that tests find the libraries? Anyway, my problem is not at link time, but when _executing_

[cmake-developers] Shared library under Windows and CMake: DLL not found before installation

2019-02-06 Thread Joachim Wuttke
The library `mylib` consists of the library proper, in directory `lib/`, and a test suite, in directory `test/`. It is completely under CMake control: mylib/CMakeLists.txt: ... add_subdirectory(lib) add_subdirectory(test) ... mylib/lib/CMakeLists.txt: ...

[cmake-developers] CMAKE_HOME_DIRECTORY vs CMAKE_SOURCE_DIR

2019-01-29 Thread Joachim Wuttke
how do these two relate to each other? - Joachim smime.p7s Description: S/MIME Cryptographic Signature -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake

[cmake-developers] Preferred case for macro names?

2018-11-12 Thread Joachim Wuttke
My understanding was that prevalent usage in modern CMake is all lowercase for function names, all uppercase for macro names. In this sense, I submitted a number of merge requests where function and macro names are normalized, and in https://gitlab.kitware.com/cmake/cmake/merge_requests/2607 I

[cmake-developers] CMake string question

2018-11-09 Thread Joachim Wuttke
if("${srcdir}" STREQUAL "${bindir}") if(srcdir STREQUAL bindir) looks more idiomatic, thank you Eike - But can we be sure that srcdir contains no blank? Or does STREQUAL work even for argument strings that contain blanks? - Joachim smime.p7s Description: S/MIME Cryptographic Signature --

[cmake-developers] module proposal: PreventInSourceBuilds

2018-11-09 Thread Joachim Wuttke
In all my projects, the top-level CMakeLists.txt contains the line include(PreventInSourceBuilds) to protect users (and myself) from unintentionally running CMake in the source directory. Would you consider adding this little module to the CMake code base? I would then add an option so that

[CMake] best way to override or bypass find_package for OS-specific settings

2018-10-20 Thread Joachim Wuttke
Project P depends on library L. L comes with a module FindL.cmake, which is so complicated that we would not be able to adapt it to our needs. On most platforms, users will build P from source, and dynamically link with L. For them, the line find_package(L REQUIRED) in P/CMakeLists.txt works

[CMake] find_package Config vs Module mode

2018-10-20 Thread Joachim Wuttke
Somewhere we are advised that Module mode should be phased out in favor of Config mode. If Config mode is the newer, preferred way to find a package, I would expect find_package to first try Config mode, and only fall back to Module mode if no config scripts can be found. However, according to

Re: [CMake] find_package Module/Config mode and nontrivial package version checks

2018-10-05 Thread Joachim Wuttke
Module mode is only selected if there is a Find.cmake file available. Otherwise Config mode is used anyway. For a given project's call only one of the modes can be used: the find module is either present or it is not. If the find module is available it is used and becomes responsible for

[CMake] find_package Module/Config mode and nontrivial package version checks

2018-10-04 Thread Joachim Wuttke
The find_package command docs [1,2] recommend that user code should generally look for packages using the Module mode signature. What then about user code that ought to check for version compatibility? Module mode only offers a check for an EXACT version string, and does not terminate if that

[CMake] FindBoost does not detect absence of header file

2016-04-12 Thread Joachim Wuttke
FindBoost does not detect absence of header files. To be specific: Run the following under cmake version 3.5.1: set(Boost_NO_BOOST_CMAKE ON) # prevent shortcut set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) add_definitions(-DBOOST_ALL_DYN_LINK)

[CMake] a cmake module that improves upon CheckLibrariesExists

2015-09-18 Thread Joachim Wuttke
may I invite your comments at http://codereview.stackexchange.com/questions/105020/a-cmake-module-that-improves-upon-checklibrariesexists where I am proposing a module AssertLibraryFunction that improves upon CheckLibrariesExists in two respects: - It honors the optional argument REQUIRED of