CMakeLists.txt 1.0 KB

123456789101112131415161718192021222324252627282930
  1. # first we add the executable that generates the table
  2. add_executable(MakeTable MakeTable.cxx)
  3. # add the command to generate the source code
  4. add_custom_command(
  5. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h
  6. COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h
  7. DEPENDS MakeTable
  8. )
  9. # add the main library
  10. add_library(MathFunctions
  11. mysqrt.cxx
  12. ${CMAKE_CURRENT_BINARY_DIR}/Table.h
  13. )
  14. # state that anybody linking to us needs to include the current source dir
  15. # to find MathFunctions.h, while we don't.
  16. # state that we depend on Tutorial_BINARY_DIR but consumers don't, as the
  17. # TutorialConfig.h include is an implementation detail
  18. # state that we depend on our binary dir to find Table.h
  19. target_include_directories(MathFunctions
  20. INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
  21. PRIVATE ${Tutorial_BINARY_DIR}
  22. ${CMAKE_CURRENT_BINARY_DIR}
  23. )
  24. # install rules
  25. install(TARGETS MathFunctions DESTINATION lib)
  26. install(FILES MathFunctions.h DESTINATION include)