Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  10 Aug 2020, Mathieu Guigue, Info, MidasConfig.cmake usage 
    Reply  28 May 2021, Konstantin Olchanski, Info, MidasConfig.cmake usage 
       Reply  28 May 2021, Marius Koeppel, Info, MidasConfig.cmake usage 
          Reply  28 May 2021, Konstantin Olchanski, Info, MidasConfig.cmake usage 
             Reply  31 May 2021, Stefan Ritt, Info, MidasConfig.cmake usage 
                Reply  02 Jun 2021, Konstantin Olchanski, Info, MidasConfig.cmake usage 
                   Reply  04 Jun 2021, Konstantin Olchanski, Info, MidasConfig.cmake usage 
                      Reply  04 Jun 2021, Konstantin Olchanski, Info, MidasConfig.cmake usage 
                      Reply  20 Jun 2021, Lukas Gerritzen, Suggestion, MidasConfig.cmake usage 
                         Reply  20 Jun 2021, Konstantin Olchanski, Suggestion, MidasConfig.cmake usage 
                            Reply  22 Jun 2021, Lukas Gerritzen, Suggestion, MidasConfig.cmake usage 
                               Reply  24 Jun 2021, Konstantin Olchanski, Suggestion, MidasConfig.cmake usage 
                                  Reply  11 Jul 2021, Konstantin Olchanski, Suggestion, MidasConfig.cmake usage 
    Reply  13 Jul 2021, Stefan Ritt, Info, MidasConfig.cmake usage 
       Reply  13 Jul 2021, Konstantin Olchanski, Info, MidasConfig.cmake usage 
Message ID: 1974     Entry time: 10 Aug 2020     Reply to this: 2185   2261
Author: Mathieu Guigue 
Topic: Info 
Subject: MidasConfig.cmake usage 
As the Midas software is installed using CMake, it can be easily integrated into 
other CMake projects using the MidasConfig.cmake file produced during the Midas 
installation.

This file points to the location of the include and libraries of Midas using three 
variables:
- MIDAS_INCLUDE_DIRS
- MIDAS_LIBRARY_DIRS
- MIDAS_LIBRARIES

Then the CMakeLists file of the new project can use the CMake find_package 
functionalities like:
```
find_package (Midas REQUIRED)
if (MIDAS_FOUND)
    MESSAGE(STATUS "Found midas: libraries ${MIDAS_LIBRARIES}")
    pbuilder_add_ext_libraries (${MIDAS_LIBRARIES})
else (MIDAS_FOUND)
    message(FATAL "Unable to find midas")
endif (MIDAS_FOUND)
include_directories (${MIDAS_INCLUDE_DIR})
```
pbuilder_add_ext_libraries is a CMake macro allowing to automatically add the 
libraries into the project: this macro can be found here: 
https://github.com/project8/scarab/blob/master/cmake/PackageBuilder.cmake
If such macro doesn't exist, the linkage to each executable/library can be done 
similarly to https://midas.triumf.ca/elog/Midas/1964 using: 

```
target_link_libraries(crfe ${MIDAS_LIBARIES} ${LIBS})
```

The current version of the MidasConfig.cmake is minimal and could for example 
include a version number: this would allow to define a e.g. minimal version of 
Midas needed by the new project.
ELOG V3.1.4-2e1708b5