smarco / WFA2-lib

WFA-lib: Wavefront alignment algorithm library v2
Other
162 stars 36 forks source link

Broken build with OMP enabled #67

Closed pettyalex closed 1 year ago

pettyalex commented 1 year ago

WFA2-lib is not building for me with cmake version 3.25.2 when OpenMP is enabled.

It looks like https://github.com/smarco/WFA2-lib/pull/64 illegally used a mix of plain and keyword-based CMake syntax for linking libraries: https://stackoverflow.com/questions/59522267/cmake-rejects-a-second-target-link-libraries-talking-about-keyword-vs-plain

Reproduction:

Build with OpenMP:

mkdir build &&  cd build
cmake -DOPENMP=ON ..
cmake --build .

Fail:

CMake Error at CMakeLists.txt:176 (target_link_libraries):
  The keyword signature for target_link_libraries has already been used with
  the target "wfa2cpp_static".  All uses of target_link_libraries with a
  target must be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * CMakeLists.txt:171 (target_link_libraries)

CMake Error at CMakeLists.txt:177 (target_link_libraries):
  The keyword signature for target_link_libraries has already been used with
  the target "wfa2cpp".  All uses of target_link_libraries with a target must
  be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * CMakeLists.txt:170 (target_link_libraries)

Solutions: Specify the scope of how OpenMP is linked to WFA2-lib. I don't see any reason to publicly expose this, so PRIVATE seems like the default option.

smarco commented 1 year ago

Thanks for the fix.