0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Merge pull request #220 from sjoubert/install_ddl2cpp

Install and export ddl2cpp script
This commit is contained in:
Roland Bock 2018-02-19 21:48:40 +01:00 committed by GitHub
commit 78c6bc0670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -72,6 +72,11 @@ install(TARGETS sqlpp11
EXPORT Sqlpp11Targets EXPORT Sqlpp11Targets
) )
install(PROGRAMS "${PROJECT_SOURCE_DIR}/scripts/ddl2cpp"
RENAME sqlpp11-ddl2cpp
DESTINATION bin
)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
write_basic_package_version_file( write_basic_package_version_file(

View File

@ -29,3 +29,17 @@ include(CMakeFindDependencyMacro)
find_dependency(HinnantDate REQUIRED) find_dependency(HinnantDate REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/Sqlpp11Targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/Sqlpp11Targets.cmake")
# Import "ddl2cpp" script
if(TARGET sqlpp11::ddl2cpp)
message(FATAL_ERROR "Target sqlpp11::ddl2cpp already defined")
endif()
get_filename_component(sqlpp11_ddl2cpp_location "${CMAKE_CURRENT_LIST_DIR}/../../../bin/sqlpp11-ddl2cpp" REALPATH)
if(NOT EXISTS "${sqlpp11_ddl2cpp_location}")
message(FATAL_ERROR "The imported target sqlpp11::ddl2cpp references the file '${sqlpp11_ddl2cpp_location}' but this file does not exists.")
endif()
add_executable(sqlpp11::ddl2cpp IMPORTED)
set_target_properties(sqlpp11::ddl2cpp PROPERTIES
IMPORTED_LOCATION "${sqlpp11_ddl2cpp_location}"
)
unset(sqlpp11_ddl2cpp_location)