Advertisement
Guest User

Untitled

a guest
Feb 15th, 2015
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. --- CMakeLists.txt ---
  2.  
  3. cmake_minimum_required(VERSION 3.1)
  4. project(Foo)
  5.  
  6. set(CMAKE_INSTALL_RPATH "@executable_path")
  7.  
  8. add_library(a a.cpp)
  9. add_executable(foo main.cpp)
  10. target_link_libraries(foo a)
  11.  
  12. install(TARGETS foo a DESTINATION bin)
  13.  
  14. --- a.cpp ---
  15.  
  16. int a() {
  17. return 42;
  18. }
  19.  
  20. --- main.cpp ---
  21.  
  22. #include <iostream>
  23. int a();
  24.  
  25. int main() {
  26. std::cout << "a: " << a() << std::endl;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement