build: search headers in all source directories

* removed paths in include directives
* changed cmake to provide necessary header search paths
* changed name of version.h to productVersion.h due to name conflict
This commit is contained in:
mlangkabel
2018-09-18 19:00:18 +02:00
parent 9dc2bcc2f9
commit dfc6d88432
961 changed files with 3441 additions and 3441 deletions
+21 -5
View File
@@ -12,18 +12,34 @@
#
macro(add_files var_name)
file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
# extract source file paths
set(files_var_name ${var_name}_FILES)
foreach (_src ${ARGN})
if (_relPath)
list (APPEND ${var_name} "${_relPath}/${_src}")
list (APPEND ${files_var_name} "${_relPath}/${_src}")
else()
list (APPEND ${var_name} "${_src}")
list (APPEND ${files_var_name} "${_src}")
endif()
endforeach()
# extract source file directories
set(include_paths_var_name ${var_name}_INCLUDE_PATHS)
foreach (_src ${${files_var_name}})
get_filename_component(PARENT_DIR "${_src}" DIRECTORY)
list (APPEND ${include_paths_var_name} "${CMAKE_SOURCE_DIR}/${PARENT_DIR}")
endforeach()
list(REMOVE_DUPLICATES ${include_paths_var_name})
if (_relPath)
set(${var_name} ${${var_name}} PARENT_SCOPE)
set(${files_var_name} ${${files_var_name}} PARENT_SCOPE)
set(${include_paths_var_name} ${${include_paths_var_name}} PARENT_SCOPE)
else()
set(${var_name} ${${var_name}})
set(${files_var_name} ${${files_var_name}})
set(${include_paths_var_name} ${${include_paths_var_name}})
endif()
endmacro()
+12
View File
@@ -0,0 +1,12 @@
#ifndef SOURCETRAIL_VERSION_H
#define SOURCETRAIL_VERSION_H
#define GIT_BRANCH "@GIT_BRANCH@"
#define GIT_VERSION_NUMBER "@GIT_VERSION_NUMBER@"
#define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@"
#define GIT_COMMIT_TIME "@GIT_COMMIT_TIME@"
#define VERSION_YEAR @VERSION_YEAR@
#define VERSION_MINOR @VERSION_MINOR@
#define VERSION_COMMIT @VERSION_COMMIT@
#endif // SOURCETRAIL_VERSION_H
+2 -2
View File
@@ -50,6 +50,6 @@ message(STATUS "Version commit: ${VERSION_COMMIT}")
message(STATUS "Git commit time: ${GIT_COMMIT_TIME}")
configure_file(
${CMAKE_SOURCE_DIR}/cmake/version.h.in
${BINARY_DIR}/src/lib_gui/version.h
${CMAKE_SOURCE_DIR}/cmake/productVersion.h.in
${BINARY_DIR}/src/lib_gui/productVersion.h
)