| 1234567891011121314151617181920212223242526272829303132 | # first we add the executable that generates the tableadd_executable(MakeTable MakeTable.cxx)# add the command to generate the source codeadd_custom_command(  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h  COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h  DEPENDS MakeTable  )# add the main libraryadd_library(MathFunctions            mysqrt.cxx            ${CMAKE_CURRENT_BINARY_DIR}/Table.h            )# state that anybody linking to us needs to include the current source dir# to find MathFunctions.h, while we don't.# state that we depend on our binary dir to find Table.htarget_include_directories(MathFunctions          INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}          PRIVATE   ${CMAKE_CURRENT_BINARY_DIR}          )# link our compiler flags interface librarytarget_link_libraries(MathFunctions tutorial_compiler_flags)# install libsset(installable_libs MathFunctions tutorial_compiler_flags)install(TARGETS ${installable_libs} DESTINATION lib)# install include headersinstall(FILES MathFunctions.h DESTINATION include)
 |