-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from niosHD/update-project-layout
Update project layout
- Loading branch information
Showing
28 changed files
with
4,504 additions
and
4,406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#------------------------------------------------------------------------------ | ||
# define the cppformat library, its includes and the needed defines | ||
set(FMT_HEADERS format.h) | ||
set(FMT_SOURCES format.cc) | ||
if (HAVE_OPEN) | ||
set(FMT_HEADERS ${FMT_HEADERS} posix.h) | ||
set(FMT_SOURCES ${FMT_SOURCES} posix.cc) | ||
endif () | ||
|
||
add_library(cppformat ${FMT_SOURCES} ${FMT_HEADERS}) | ||
|
||
target_compile_options(cppformat PUBLIC ${CPP11_FLAG}) # starting with cmake 3.1 the CXX_STANDARD property can be used | ||
if (FMT_PEDANTIC) | ||
target_compile_options(cppformat PRIVATE ${PEDANTIC_COMPILE_FLAGS}) | ||
endif () | ||
|
||
target_include_directories(cppformat INTERFACE | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
set_target_properties(cppformat PROPERTIES | ||
VERSION ${CPPFORMAT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}) | ||
|
||
if (BUILD_SHARED_LIBS) | ||
if (UNIX AND NOT APPLE) | ||
# Fix rpmlint warning: | ||
# unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6. | ||
target_link_libraries(cppformat -Wl,--as-needed) | ||
endif () | ||
target_compile_definitions(cppformat PRIVATE FMT_EXPORT INTERFACE FMT_SHARED) | ||
endif () | ||
|
||
#------------------------------------------------------------------------------ | ||
# additionally define a header only library when cmake is new enough | ||
if (CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0) | ||
add_library(cppformat-header-only INTERFACE) | ||
|
||
target_compile_definitions(cppformat-header-only INTERFACE FMT_HEADER_ONLY=1) | ||
|
||
target_include_directories(cppformat-header-only INTERFACE | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:include>) | ||
endif () | ||
|
||
# Install targets. | ||
if (FMT_INSTALL) | ||
include(CMakePackageConfigHelpers) | ||
set(config_install_dir lib/cmake/cppformat) | ||
set(version_config ${PROJECT_BINARY_DIR}/cppformat-config-version.cmake) | ||
set(project_config ${PROJECT_BINARY_DIR}/cppformat-config.cmake) | ||
set(targets_export_name cppformat-targets) | ||
|
||
set (INSTALL_TARGETS cppformat) | ||
if (TARGET cppformat-header-only) | ||
set(INSTALL_TARGETS ${INSTALL_TARGETS} cppformat-header-only) | ||
endif () | ||
|
||
set(FMT_LIB_DIR lib CACHE STRING | ||
"Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.") | ||
|
||
# Generate the version, config and target files into the build directory. | ||
write_basic_package_version_file( | ||
${version_config} | ||
VERSION ${CPPFORMAT_VERSION} | ||
COMPATIBILITY AnyNewerVersion) | ||
configure_package_config_file( | ||
${PROJECT_SOURCE_DIR}/support/cmake/cppformat-config.cmake.in | ||
${project_config} | ||
INSTALL_DESTINATION ${config_install_dir}) | ||
export(TARGETS ${INSTALL_TARGETS} FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake) | ||
|
||
# Install version, config and target files. | ||
install( | ||
FILES ${project_config} ${version_config} | ||
DESTINATION ${config_install_dir}) | ||
install(EXPORT ${targets_export_name} DESTINATION ${config_install_dir}) | ||
|
||
# Install the library and the include file. | ||
install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} DESTINATION ${FMT_LIB_DIR}) | ||
install(FILES ${FMT_HEADERS} DESTINATION include/cppformat) | ||
endif () |
File renamed without changes.
Oops, something went wrong.