Guest User

Untitled

a guest
Nov 21st, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. cmake_minimum_required(VERSION 3.9)
  2.  
  3. project(cmake-target-link-libs-strange-genexps LANGUAGES C)
  4.  
  5. file(WRITE "hello.h"
  6. [[
  7. void hello(void);
  8. ]])
  9. file(WRITE "hello.c"
  10. [[
  11. #include <hello.h>
  12. #include <stdio.h>
  13. void hello(void) { puts("Hello"); }
  14. ]])
  15. file(WRITE "main.c"
  16. [[
  17. #include <hello.h>
  18. int main(void) { hello(); return 0; }
  19. ]])
  20.  
  21. add_executable(main "main.c")
  22. add_library(hello "hello.c")
  23.  
  24. target_include_directories(hello PUBLIC "${CMAKE_SOURCE_DIR}")
  25.  
  26. if (something)
  27. message(STATUS "not printed by default, of course")
  28. endif ()
  29.  
  30. target_link_libraries(main PRIVATE $<$<BOOL:something>:hello>) # evaluates to "hello", wait what?
Add Comment
Please, Sign In to add comment