• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cmake_minimum_required(VERSION 2.8.7)
2
3project(iio_genxml  C)
4project(iio_info    C)
5project(iio_attr    C)
6project(iio_readdev C)
7project(iio_reg     C)
8
9if (MSVC)
10	include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../deps/wingetopt/src)
11	set(GETOPT_C_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../deps/wingetopt/src/getopt.c)
12endif (MSVC)
13
14if (WIN32)
15	set(LIBIIO_ORIGINAL_FILENAME )
16	set(LIBIIO_RC ${CMAKE_CURRENT_BINARY_DIR}/properties.rc)
17	configure_file(../properties.rc.cmakein ${LIBIIO_RC} @ONLY)
18endif()
19add_executable(iio_genxml  iio_genxml.c   ${GETOPT_C_FILE} ${LIBIIO_RC})
20add_executable(iio_info    iio_info.c     ${GETOPT_C_FILE} ${LIBIIO_RC})
21add_executable(iio_attr    iio_attr.c     ${GETOPT_C_FILE} ${LIBIIO_RC})
22add_executable(iio_readdev iio_readdev.c  ${GETOPT_C_FILE} ${LIBIIO_RC})
23add_executable(iio_reg     iio_reg.c      ${GETOPT_C_FILE} ${LIBIIO_RC})
24add_executable(iio_writedev iio_writedev.c  ${GETOPT_C_FILE} ${LIBIIO_RC})
25
26target_link_libraries(iio_genxml  iio)
27target_link_libraries(iio_info    iio)
28target_link_libraries(iio_attr    iio)
29target_link_libraries(iio_readdev iio)
30target_link_libraries(iio_reg     iio)
31target_link_libraries(iio_writedev iio)
32
33set(IIO_TESTS_TARGETS iio_genxml iio_info iio_attr iio_readdev iio_reg iio_writedev)
34
35if(PTHREAD_LIBRARIES)
36	project(iio_adi_xflow_check C)
37	add_executable(iio_adi_xflow_check iio_adi_xflow_check.c)
38	target_link_libraries(iio_adi_xflow_check iio ${PTHREAD_LIBRARIES})
39	set(IIO_TESTS_TARGETS ${IIO_TESTS_TARGETS} iio_adi_xflow_check)
40
41	target_link_libraries(iio_readdev  ${PTHREAD_LIBRARIES})
42	target_link_libraries(iio_writedev ${PTHREAD_LIBRARIES})
43endif()
44
45set_target_properties(${IIO_TESTS_TARGETS} PROPERTIES
46	C_STANDARD 99
47	C_STANDARD_REQUIRED ON
48	C_EXTENSIONS OFF
49)
50
51if(NOT SKIP_INSTALL_ALL)
52	if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
53		install(TARGETS ${IIO_TESTS_TARGETS} RUNTIME DESTINATION /Library/Frameworks/iio.framework/Tools)
54	else()
55		install(TARGETS ${IIO_TESTS_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
56	endif()
57endif()
58
59# Make the test targets available to the main CMakeLists.txt
60set(IIO_TESTS_TARGETS ${IIO_TESTS_TARGETS} PARENT_SCOPE)
61