Skip to content

Commit 4f7c018

Browse files
committed
CMakeLists.txt is needed
1 parent 79d2d2c commit 4f7c018

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CMakeLists.txt in tests/header-check
2+
cmake_minimum_required(VERSION 3.15)
3+
project(PublicHeaderCheck C)
4+
5+
# Set this to your install prefix or build tree path
6+
set(PM_INCLUDE_DIR "/usr/local/include")
7+
8+
# List your public headers here
9+
set(PUBLIC_HEADERS
10+
"${PM_INCLUDE_DIR}/projectM-4/playlist.h"
11+
)
12+
13+
# Generate dummy .c files that just include the headers
14+
foreach(header IN LISTS PUBLIC_HEADERS)
15+
get_filename_component(header_file "${header}" NAME)
16+
set(test_source "${CMAKE_BINARY_DIR}/check_${header_file}.c")
17+
18+
file(WRITE "${test_source}" "#include \"${header}\"\nint main(void) { return 0; }\n")
19+
add_executable("check_${header_file}" "${test_source}")
20+
target_include_directories("check_${header_file}" PRIVATE "${PM_INCLUDE_DIR}")
21+
endforeach()

0 commit comments

Comments
 (0)