diff options
-rw-r--r-- | cmake/Modules/CMakeOverloads.cmake | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/cmake/Modules/CMakeOverloads.cmake b/cmake/Modules/CMakeOverloads.cmake index 04fc777a9f..450d44c95a 100644 --- a/cmake/Modules/CMakeOverloads.cmake +++ b/cmake/Modules/CMakeOverloads.cmake @@ -44,27 +44,26 @@ macro(INCLUDE_DIRECTORIES) # is this dir the literal string "BEFORE" or "AFTER"? string(FIND ${inc_dir} BEFORE IS_BEFORE) string(FIND ${inc_dir} AFTER IS_AFTER) - if(${IS_BEFORE} EQUAL 0 OR ${IS_AFTER} EQUAL 0) - # yes: ignore it - continue() - endif() + if(NOT ${IS_BEFORE} EQUAL 0 AND NOT ${IS_AFTER} EQUAL 0) - # get absolute path of this include directory - get_filename_component(inc_dir_abs ${inc_dir} ABSOLUTE) + # not "BEFORE" or "AFTER"; a real directory. + # get absolute path of this include directory + get_filename_component(inc_dir_abs ${inc_dir} ABSOLUTE) - # is this include directory located within the SOURCE or BUILD? - string(FIND ${inc_dir_abs} ${CMAKE_SOURCE_DIR} IS_IN_SOURCE) - string(FIND ${inc_dir_abs} ${CMAKE_BINARY_DIR} IS_IN_BINARY) - if(${IS_IN_SOURCE} EQUAL 0 OR ${IS_IN_BINARY} EQUAL 0) - # yes: local SOURCE or BINARY; internal. - # call the overloaded INCLUDE_DIRECTORIES, - # prepending this internal directory. - _include_directories(BEFORE ${inc_dir_abs}) - else() - # no: not SOURCE or BUILD; must be external. - # call the overloaded INCLUDE_DIRECTORIES, - # appending this external directory. - _include_directories(AFTER ${inc_dir_abs}) + # is this include directory located within the SOURCE or BUILD? + string(FIND ${inc_dir_abs} ${CMAKE_SOURCE_DIR} IS_IN_SOURCE) + string(FIND ${inc_dir_abs} ${CMAKE_BINARY_DIR} IS_IN_BINARY) + if(${IS_IN_SOURCE} EQUAL 0 OR ${IS_IN_BINARY} EQUAL 0) + # yes: local SOURCE or BINARY; internal. + # call the overloaded INCLUDE_DIRECTORIES, + # prepending this internal directory. + _include_directories(BEFORE ${inc_dir_abs}) + else() + # no: not SOURCE or BUILD; must be external. + # call the overloaded INCLUDE_DIRECTORIES, + # appending this external directory. + _include_directories(AFTER ${inc_dir_abs}) + endif() endif() endforeach() endmacro(INCLUDE_DIRECTORIES) |