mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
9f8bd77d7b
Now that uv.h is directly being included, pre-processing of test/includes/pre/uv.h fails on Linux with In file included from «SRCDIR»/neovim/test/includes/pre/uv.h:1: In file included from /usr/include/uv.h:62: /usr/include/uv/unix.h:72:11: fatal error: 'uv/pthread-barrier.h' file not found # include "uv/pthread-barrier.h" ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. This happens because we're missing -D_GNU_SOURCE (part of ${gen_cdefs}), which makes the pthread_barrier_* functionality visible.
33 lines
1.1 KiB
CMake
33 lines
1.1 KiB
CMake
file(GLOB_RECURSE PRE_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} pre/*.h)
|
|
|
|
# We need to add the SDK directories on OS X, and perhaps other operating
|
|
# systems.
|
|
set(gen_cflags)
|
|
foreach(gen_include ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES})
|
|
list(APPEND gen_cflags ${CMAKE_INCLUDE_FLAG_C}${gen_include})
|
|
endforeach()
|
|
|
|
get_directory_property(gen_cdefs COMPILE_DEFINITIONS)
|
|
foreach(gen_cdef ${gen_cdefs})
|
|
if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS")
|
|
list(APPEND gen_cflags "-D${gen_cdef}")
|
|
endif()
|
|
endforeach()
|
|
|
|
foreach(hfile ${PRE_HEADERS})
|
|
string(REGEX REPLACE ^pre/ post/ post_hfile ${hfile})
|
|
get_filename_component(hdir ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile} PATH)
|
|
file(MAKE_DIRECTORY ${hdir})
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}
|
|
COMMAND ${CMAKE_C_COMPILER} -std=c99 -E -P
|
|
${CMAKE_CURRENT_SOURCE_DIR}/${hfile}
|
|
${gen_cflags}
|
|
-I${LIBUV_INCLUDE_DIRS}
|
|
-o ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile})
|
|
list(APPEND POST_HEADERS ${post_hfile})
|
|
endforeach()
|
|
|
|
add_custom_target(unittest-headers DEPENDS ${POST_HEADERS})
|
|
set_target_properties(unittest-headers PROPERTIES FOLDER test)
|