-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
33 lines (23 loc) · 1.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
cmake_minimum_required( VERSION 3.0 )
project( libihex LANGUAGES C )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
enable_testing( )
include_directories( ${PROJECT_SOURCE_DIR}/src )
file( GLOB SRC_FILES src/*.c )
add_library( ihex SHARED ${SRC_FILES} )
set_target_properties( ihex PROPERTIES VERSION 0.1.0 SOVERSION 1 )
install( TARGETS ihex DESTINATION lib )
install( FILES src/ihex.h DESTINATION include )
add_executable( example example/main.c )
target_link_libraries( example ihex )
add_executable( test_parse tests/test_parse.c )
target_link_libraries( test_parse ihex )
add_test( test_parse ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_parse )
add_executable( test_dump tests/test_dump.c )
target_link_libraries( test_dump ihex )
add_test( test_dump ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_dump )
add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} --verbose )
add_custom_target( cleanall COMMAND rm -rf Makefile CMakeCache.txt CMakeFiles/ bin/ lib/ cmake_install.cmake CTestTestfile.cmake Testing/ )
add_custom_target( uninstall COMMAND xargs rm < install_manifest.txt )