-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cmake] Export config properly #262
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
cmake_minimum_required (VERSION 3.6...3.9) | ||
project(IfcPlusPlus) | ||
project(IfcPlusPlus LANGUAGES CXX) | ||
|
||
ADD_DEFINITIONS(-DIFCQUERY_STATIC_LIB) | ||
ADD_DEFINITIONS(-DIFCQUERY_LIB) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC=1) | ||
ADD_DEFINITIONS(-DUNICODE) | ||
ADD_DEFINITIONS(-D_UNICODE) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD C++17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
if(WIN32) | ||
|
@@ -75,9 +74,14 @@ if (MSVC) | |
set_source_files_properties(src/ifcpp/IFC4X3/TypeFactory.cpp PROPERTIES COMPILE_FLAGS /bigobj) | ||
endif() | ||
|
||
add_library(IfcPlusPlus STATIC ${IFCPP_SOURCE_FILES}) | ||
add_library(IfcPlusPlus ${IFCPP_SOURCE_FILES}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default is STATIC unless |
||
|
||
if(NOT BUILD_SHARED_LIBS) | ||
target_compile_definitions(IfcPlusPlus PUBLIC IFCQUERY_STATIC_LIB) | ||
endif() | ||
|
||
TARGET_INCLUDE_DIRECTORIES(IfcPlusPlus | ||
PUBLIC "$<INSTALL_INTERFACE:include;include/ifcpp/IFC4X3/include;include/ifcpp/external>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required for proper |
||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/src | ||
${IFCPP_SOURCE_DIR}/IfcPlusPlus/src | ||
|
@@ -107,24 +111,32 @@ install( | |
DESTINATION include | ||
FILES_MATCHING PATTERN "*.h" | ||
) | ||
|
||
# Install cmake config | ||
|
||
set(IFCPP_CONFIG_DIR "share/IFCPP") | ||
|
||
install( | ||
TARGETS IfcPlusPlus | ||
EXPORT IfcPlusPlus | ||
EXPORT IFCPPTargets | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION bin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
ARCHIVE DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) | ||
|
||
set(target_output_filename IfcPlusPlus-targets.cmake) | ||
set(target_output "${CMAKE_BINARY_DIR}/cmake/${target_output_filename}") | ||
|
||
export( | ||
EXPORT IfcPlusPlus | ||
FILE ${target_output} | ||
NAMESPACE IFCPP::) | ||
install( | ||
EXPORT IFCPPTargets | ||
DESTINATION "${IFCPP_CONFIG_DIR}" | ||
NAMESPACE IFCPP:: | ||
) | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/IFCPPConfig.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/IFCPPConfig.cmake" | ||
INSTALL_DESTINATION "${IFCPP_CONFIG_DIR}" | ||
) | ||
install( | ||
EXPORT IfcPlusPlus | ||
DESTINATION ${IFCPP_CONFIG_DIR} | ||
FILE ${target_output_filename} | ||
NAMESPACE IFCPP::) | ||
FILES "${CMAKE_CURRENT_BINARY_DIR}/IFCPPConfig.cmake" | ||
DESTINATION "${IFCPP_CONFIG_DIR}" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/IFCPPTargets.cmake") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've merged this with previous
project
. There's no reason to do this twice with different names.