9ede4b327cd1b004e47521a5960f9ada0afc24ad
[platform/upstream/cmake.git] / Help / guide / tutorial / Step8 / 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 Tutorial_BINARY_DIR but consumers don't, as the
20 # TutorialConfig.h include is an implementation detail
21 # state that we depend on our binary dir to find Table.h
22 target_include_directories(MathFunctions
23           INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
24           PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
25           )
26
27 # install rules
28 install(TARGETS MathFunctions DESTINATION lib)
29 install(FILES MathFunctions.h DESTINATION include)