eic / eic/BeastMagneticField

CMake fails with "INSTALL TARGETS given no LIBRARY DESTINATION"

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

`cmake -DCMAKE_INSTALL_PREFIX=/usr/local/bmf/ ..` (version 3.13.4) fails with:
```
CMake Error at CMakeLists.txt:43 (INSTALL):
INSTALL TARGETS given no LIBRARY DESTINATION for shared library target
"bmf".

CMake Error at CMakeLists.txt:44 (INSTALL):
INSTALL TARGETS given no RUNTIME DESTINATION for executable target
"bmf-main".

-- Configuring incomplete, errors occurred!
See also "/home/wdconinc/git/BeastMagneticField/build/CMakeFiles/CMakeOutput.log".
```

The following patch makes it work:
```
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a7481d..4f4cdb2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,5 +40,5 @@ ADD_EXECUTABLE( ${BMF_EXE} ${MAIN_SRC} )
TARGET_LINK_LIBRARIES( ${BMF_EXE} ${BMF_LIB} )

INSTALL(FILES ${PROJECT_SOURCE_DIR}/include/BeastMagneticField.h DESTINATION include)
-INSTALL(TARGETS ${BMF_LIB} DESTINATION ${CMAKE_INSTALL_LIBDIR})
-INSTALL(TARGETS ${BMF_EXE} DESTINATION ${CMAKE_INSTALL_BINDIR})
+INSTALL(TARGETS ${BMF_LIB} LIBRARY DESTINATION lib ${CMAKE_INSTALL_LIBDIR})
+INSTALL(TARGETS ${BMF_EXE} RUNTIME DESTINATION bin ${CMAKE_INSTALL_BINDIR})
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.