You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
728 B
19 lines
728 B
3 years ago
|
enable_language(C)
|
||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.c" "int main() { return 0;}")
|
||
|
|
||
|
set(include_dir "${CMAKE_CURRENT_BINARY_DIR}/dir")
|
||
|
set(before_include_dir "${CMAKE_CURRENT_BINARY_DIR}/dirBefore")
|
||
|
file(MAKE_DIRECTORY "${include_dir}")
|
||
|
file(MAKE_DIRECTORY "${before_include_dir}")
|
||
|
|
||
|
add_executable(main "${CMAKE_CURRENT_BINARY_DIR}/main.c")
|
||
|
include_directories("${include_dir}")
|
||
|
target_include_directories(main BEFORE PRIVATE "${before_include_dir}")
|
||
|
|
||
|
get_target_property(actual_include_dirs main INCLUDE_DIRECTORIES)
|
||
|
set(desired_include_dirs "${before_include_dir}" "${include_dir}")
|
||
|
|
||
|
if (NOT "${actual_include_dirs}" MATCHES "${desired_include_dirs}")
|
||
|
message(SEND_ERROR "include before does not work")
|
||
|
endif()
|