Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Help / guide / tutorial / Step10 / MathFunctions / CMakeLists.txt
1 # first we add the executable that generates the table
2 add_executable(MakeTable MakeTable.cxx)
3
4 # add the command to generate the source code
5 add_custom_command(
6   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h
7   COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h
8   DEPENDS MakeTable
9   )
10
11 # add the main library
12 add_library(MathFunctions
13             mysqrt.cxx
14             ${CMAKE_CURRENT_BINARY_DIR}/Table.h
15             )
16
17 # state that anybody linking to us needs to include the current source dir
18 # to find MathFunctions.h, while we don't.
19 # state that we depend on our binary dir to find Table.h
20 target_include_directories(MathFunctions
21           INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
22           PRIVATE   ${CMAKE_CURRENT_BINARY_DIR}
23           )
24
25 # link our compiler flags interface library
26 target_link_libraries(MathFunctions tutorial_compiler_flags)
27
28 # install libs
29 set(installable_libs MathFunctions tutorial_compiler_flags)
30 install(TARGETS ${installable_libs} DESTINATION lib)
31 # install include headers
32 install(FILES MathFunctions.h DESTINATION include)