CMakeLists.txt
CMakeLists.txt
?
,
:
root/
+
+
| +
| +
| +
| +
| +
+
+
+
+
| +
+
+
+
CMakeLists.txt:
CMakeLists.txt
cmake, , .
root/CMakeLists.txt
:
cmake_minimum_required (VERSION 3.5)
project (my_project C)
add_subdirectory(foo)
add_subdirectory(bar)
CMakeLists.txt:
CMakeLists.txt
, , ..
root/foo/CMakeLists.txt
:
add_library(foo foo.c)
target_include_directories(foo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(tests)
root/foo/tests/CMakeLists.txt
:
add_executable(foo_test foo_tests.c)
target_link_libraries(foo_test foo)
..
root/foo/CMakeLists.txt
:
add_library(bar
bar.c
bar_impl/bar_impl.c)
target_include_directories(bar PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(bar foo)
add_subdirectory(tests)
root/bar/tests/CMakeLists.txt
:
add_executable(bar_test bar_tests.c)
target_link_libraries(bar_test bar)
:
, cmake root/CMakeLists.txt
cd root
mkdir build
cd build
cmake ..
( ide )
, , . :
, :
CMakeLists.txt?
(. ).
, .
, , , CMakeLists.txt
-
:
foo/
+
+
+
+
+
foo
, :
add_library(foo
foo.c
bar.c
baz/baz.c
baz/bang.c)
SRCS
set(SRCS
foo.c
bar.c
baz/baz.c
baz/bang.c)
add_library(foo ${SRCS})