Commit f7e89ba9 authored by Andreas Schuh's avatar Andreas Schuh

Move public header files to src/ subdirectory. Copy them to…

Move public header files to src/ subdirectory. Copy them to <prefix>/include/<ns>/ upon installation.
parent 3624d33a
...@@ -73,9 +73,9 @@ endif () ...@@ -73,9 +73,9 @@ endif ()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# source files - excluding root subdirectory and/or .in suffix # source files - excluding root subdirectory and/or .in suffix
set (PUBLIC_HDRS set (PUBLIC_HDRS
"gflags/gflags.h" "gflags.h"
"gflags/gflags_declare.h" "gflags_declare.h"
"gflags/gflags_completions.h" "gflags_completions.h"
) )
set (PRIVATE_HDRS set (PRIVATE_HDRS
...@@ -96,23 +96,22 @@ else () ...@@ -96,23 +96,22 @@ else ()
set (__ATTRIBUTE__UNUSED) set (__ATTRIBUTE__UNUSED)
endif () endif ()
function (configure_sources out subdir) function (configure_sources out)
set (tmp) set (tmp)
foreach (src IN LISTS ARGN) foreach (src IN LISTS ARGN)
set (src "${subdir}/${src}") if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in")
if (EXISTS "${PROJECT_SOURCE_DIR}/${src}.in") configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}" @ONLY)
configure_file ("${PROJECT_SOURCE_DIR}/${src}.in" "${PROJECT_BINARY_DIR}/${src}" @ONLY) list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}")
list (APPEND tmp "${PROJECT_BINARY_DIR}/${src}")
else () else ()
list (APPEND tmp "${PROJECT_SOURCE_DIR}/${src}") list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}")
endif () endif ()
endforeach () endforeach ()
set (${out} "${tmp}" PARENT_SCOPE) set (${out} "${tmp}" PARENT_SCOPE)
endfunction () endfunction ()
configure_sources (PUBLIC_HDRS include ${PUBLIC_HDRS}) configure_sources (PUBLIC_HDRS ${PUBLIC_HDRS})
configure_sources (PRIVATE_HDRS src ${PRIVATE_HDRS}) configure_sources (PRIVATE_HDRS ${PRIVATE_HDRS})
configure_sources (GFLAGS_SRCS src ${GFLAGS_SRCS}) configure_sources (GFLAGS_SRCS ${GFLAGS_SRCS})
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# output directories # output directories
...@@ -122,20 +121,14 @@ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib") ...@@ -122,20 +121,14 @@ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib")
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# add library target # add library target
include_directories (
"${PROJECT_BINARY_DIR}/include"
"${PROJECT_SOURCE_DIR}/include"
"${PROJECT_BINARY_DIR}/src"
"${PROJECT_SOURCE_DIR}/src"
)
if (WIN32) if (WIN32)
add_definitions (-DGFLAGS_DLL_EXPORT) add_definitions (-DGFLAGS_DLL_EXPORT)
endif () endif ()
include_directories ("${PROJECT_BINARY_DIR}/include")
include_directories ("${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}")
add_library (gflags ${GFLAGS_SRCS}) add_library (gflags ${GFLAGS_SRCS})
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# installation # installation
install (TARGETS gflags DESTINATION lib) install (TARGETS gflags DESTINATION lib)
install (FILES ${PUBLIC_HDRS} DESTINATION include/gflags) install (FILES ${PUBLIC_HDRS} DESTINATION include/${GFLAGS_NAMESPACE})
...@@ -55,6 +55,11 @@ ...@@ -55,6 +55,11 @@
// Define to 1 if you have the <pthread.h> header file. // Define to 1 if you have the <pthread.h> header file.
#define HAVE_PTHREAD @HAVE_PTHREAD@ #define HAVE_PTHREAD @HAVE_PTHREAD@
// gcc requires this to get PRId64, etc.
#if HAVE_INTTYPES_H && !defined(__STDC_FORMAT_MACROS)
# define __STDC_FORMAT_MACROS 1
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Path separator // Path separator
#ifndef PATH_SEPARATOR #ifndef PATH_SEPARATOR
......
...@@ -87,18 +87,14 @@ ...@@ -87,18 +87,14 @@
// other hand, hooks into CommandLineFlagParser. Other API functions // other hand, hooks into CommandLineFlagParser. Other API functions
// are, similarly, mostly hooks into the functionality described above. // are, similarly, mostly hooks into the functionality described above.
// This comes first to ensure we define __STDC_FORMAT_MACROS in time. #include "config.h"
#include <config.h> #include "gflags.h"
#if HAVE_INTTYPES_H && !defined(__STDC_FORMAT_MACROS)
# define __STDC_FORMAT_MACROS 1 // gcc requires this to get PRId64, etc.
#endif
#include <gflags/gflags.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#if HAVE_FNMATCH_H #if HAVE_FNMATCH_H
# include <fnmatch.h> # include <fnmatch.h>
#endif #endif
#include <stdarg.h> // For va_list and related operations #include <stdarg.h> // For va_list and related operations
#include <stdio.h> #include <stdio.h>
...@@ -109,13 +105,10 @@ ...@@ -109,13 +105,10 @@
#include <string> #include <string>
#include <utility> // for pair<> #include <utility> // for pair<>
#include <vector> #include <vector>
#include "mutex.h" #include "mutex.h"
#include "util.h" #include "util.h"
#ifndef PATH_SEPARATOR
# define PATH_SEPARATOR '/'
#endif
// Special flags, type 1: the 'recursive' flags. They set another flag's val. // Special flags, type 1: the 'recursive' flags. They set another flag's val.
DEFINE_string(flagfile, "", DEFINE_string(flagfile, "",
......
...@@ -103,7 +103,9 @@ ...@@ -103,7 +103,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <gflags/gflags_declare.h> // IWYU pragma: export
#include <@GFLAGS_NAMESPACE@/gflags_declare.h> // IWYU pragma: export
namespace @GFLAGS_NAMESPACE@ { namespace @GFLAGS_NAMESPACE@ {
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
// 5b) Trim most flag's descriptions to fit on a single terminal line // 5b) Trim most flag's descriptions to fit on a single terminal line
#include <config.h> #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> // for strlen #include <string.h> // for strlen
...@@ -57,7 +58,7 @@ ...@@ -57,7 +58,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <gflags/gflags.h> #include "gflags.h"
#include "util.h" #include "util.h"
using std::set; using std::set;
......
...@@ -48,15 +48,17 @@ ...@@ -48,15 +48,17 @@
// called after all flag-values have been assigned, that is, after // called after all flag-values have been assigned, that is, after
// parsing the command-line. // parsing the command-line.
#include <config.h> #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <gflags/gflags.h>
#include <gflags/gflags_completions.h> #include "gflags.h"
#include "gflags_completions.h"
#include "util.h" #include "util.h"
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#ifndef GFLAGS_UTIL_H_ #ifndef GFLAGS_UTIL_H_
#define GFLAGS_UTIL_H_ #define GFLAGS_UTIL_H_
#include "config.h"
#include <assert.h> #include <assert.h>
#include <config.h> #include <config.h>
#if HAVE_INTTYPES_H #if HAVE_INTTYPES_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment