Add config.h.in which produces the config.h on CMake configure.
This commit is contained in:
+10
-7
@@ -5,6 +5,11 @@ if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
|
||||
)
|
||||
|
||||
# Adhere to GNU filesystem layout conventions.
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@@ -102,10 +107,8 @@ set(TARGET webcc)
|
||||
|
||||
add_library(${TARGET} STATIC ${HEADERS} ${SOURCES})
|
||||
|
||||
if(WEBCC_ENABLE_INSTALL)
|
||||
# Install lib and header files.
|
||||
# On Linux, if CMAKE_INSTALL_PREFIX is ~, the lib (libwebcc.a) will be installed
|
||||
# to ~/lib and header files will be installed to ~/include.
|
||||
install(TARGETS ${TARGET} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webcc)
|
||||
endif()
|
||||
# Install lib and header files.
|
||||
# On Linux, if CMAKE_INSTALL_PREFIX is ~, the lib (libwebcc.a) will be installed
|
||||
# to ~/lib and header files will be installed to ~/include.
|
||||
install(TARGETS ${TARGET} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webcc)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef WEBCC_CONFIG_H_
|
||||
#define WEBCC_CONFIG_H_
|
||||
|
||||
// Compile configurations.
|
||||
|
||||
#define WEBCC_ENABLE_LOG @WEBCC_ENABLE_LOG@
|
||||
|
||||
#if WEBCC_ENABLE_LOG
|
||||
#define WEBCC_LOG_LEVEL @WEBCC_LOG_LEVEL@
|
||||
#endif
|
||||
|
||||
#endif // WEBCC_CONFIG_H_
|
||||
+3
-2
@@ -3,6 +3,9 @@
|
||||
|
||||
// Simple console logger.
|
||||
|
||||
// This file was generated from "config.h.in" by CMake.
|
||||
#include "webcc/config.h"
|
||||
|
||||
#if WEBCC_ENABLE_LOG
|
||||
|
||||
#include <cstring> // for strrchr()
|
||||
@@ -16,8 +19,6 @@
|
||||
#define WEBCC_FATA 4
|
||||
|
||||
// Default log level.
|
||||
// You have to define a proper log level in CMakeLists.txt, e.g.,
|
||||
// add_definitions(-DWEBCC_LOG_LEVEL=2)
|
||||
#ifndef WEBCC_LOG_LEVEL
|
||||
#define WEBCC_LOG_LEVEL WEBCC_WARN
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user