Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if(BUILD_POSTGRESQL_CONNECTOR)
endif()

if(BUILD_WITH_MODULES)
add_subdirectory(module)
add_subdirectory(modules)
endif()

### Packaging
Expand All @@ -112,7 +112,6 @@ write_basic_package_version_file(Sqlpp23ConfigVersion.cmake
ARCH_INDEPENDENT
)


install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Sqlpp23ConfigVersion.cmake
DESTINATION ${SQLPP23_INSTALL_CMAKEDIR}
)
Expand Down Expand Up @@ -151,7 +150,6 @@ if(BUILD_POSTGRESQL_CONNECTOR)
install_component(NAME Sqlpp23PostgreSQL TARGETS sqlpp23_postgresql DIRECTORY postgresql)
endif()


### Tests
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests)
Expand Down
20 changes: 18 additions & 2 deletions module/CMakeLists.txt → modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# The module targets should really be of INTERFACE type, because it is a header-only
# library which doesn't build any library files for them. However CMake disallows
# using the INTERFACE library type if the library has any C++20 modules. For details
# see https://discourse.cmake.org/t/header-only-libraries-and-c-20-modules/10680
#
# On the other hand using a regular library type for the module libraries means
# that any call to install(TARGET...) for the module targets will fail because it will
# also try to install the non-existent library file. This in turn means that we cannot
# use install(TARGET...) to install the .cmm files and have to resort to
# install(FILES...)

set(SQLPP23_INSTALL_MODULE_DIR ${CMAKE_INSTALL_PREFIX}/modules/sqlpp23)

# Core library module
add_library(sqlpp23.core.module)
target_sources(sqlpp23.core.module
Expand All @@ -30,6 +43,7 @@ target_sources(sqlpp23.core.module
sqlpp23.core.cppm
)
target_link_libraries(sqlpp23.core.module PUBLIC sqlpp23)
install(FILES sqlpp23.core.cppm DESTINATION ${SQLPP23_INSTALL_MODULE_DIR})

add_library(sqlpp23.mock_db.module)
target_sources(sqlpp23.mock_db.module
Expand All @@ -38,6 +52,7 @@ target_sources(sqlpp23.mock_db.module
sqlpp23.mock_db.cppm
)
target_link_libraries(sqlpp23.mock_db.module PUBLIC sqlpp23.core.module)
install(FILES sqlpp23.mock_db.cppm DESTINATION ${SQLPP23_INSTALL_MODULE_DIR})

if(BUILD_SQLITE3_CONNECTOR OR BUILD_SQLCIPHER_CONNECTOR)
add_library(sqlpp23.sqlite3.module)
Expand All @@ -47,6 +62,7 @@ if(BUILD_SQLITE3_CONNECTOR OR BUILD_SQLCIPHER_CONNECTOR)
sqlpp23.sqlite3.cppm
)
target_link_libraries(sqlpp23.sqlite3.module PUBLIC sqlpp23.core.module sqlpp23::sqlite3)
install(FILES sqlpp23.sqlite3.cppm DESTINATION ${SQLPP23_INSTALL_MODULE_DIR})
endif()

if(BUILD_MYSQL_CONNECTOR OR BUILD_MARIADB_CONNECTOR)
Expand All @@ -57,6 +73,7 @@ if(BUILD_MYSQL_CONNECTOR OR BUILD_MARIADB_CONNECTOR)
sqlpp23.mysql.cppm
)
target_link_libraries(sqlpp23.mysql.module PUBLIC sqlpp23.core.module sqlpp23::mysql)
install(FILES sqlpp23.mysql.cppm DESTINATION ${SQLPP23_INSTALL_MODULE_DIR})
endif()

if(BUILD_POSTGRESQL_CONNECTOR)
Expand All @@ -67,6 +84,5 @@ if(BUILD_POSTGRESQL_CONNECTOR)
sqlpp23.postgresql.cppm
)
target_link_libraries(sqlpp23.postgresql.module PUBLIC sqlpp23.core.module sqlpp23::postgresql)
install(FILES sqlpp23.postgresql.cppm DESTINATION ${SQLPP23_INSTALL_MODULE_DIR})
endif()


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(BUILD_WITH_MODULES)
target_sources(sqlpp23.test.core.tables.module
PUBLIC
FILE_SET all_my_modules TYPE CXX_MODULES FILES
module/sqlpp23.test.core.tables.cppm
modules/sqlpp23.test.core.tables.cppm
)
target_link_libraries(sqlpp23.test.core.tables.module PUBLIC sqlpp23.core.module)
endif()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module;

// clang-format off
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/core/tables.sql --path-to-module tests/core/module/sqlpp23.test.core.tables.cppm --module-name=sqlpp23.test.core.tables --namespace test --assume-auto-id
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/core/tables.sql --path-to-module tests/core/modules/sqlpp23.test.core.tables.cppm --module-name=sqlpp23.test.core.tables --namespace test --assume-auto-id

#include <optional>

Expand Down
2 changes: 1 addition & 1 deletion tests/mysql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(BUILD_WITH_MODULES)
target_sources(sqlpp23.test.mysql.tables.module
PUBLIC
FILE_SET all_my_modules TYPE CXX_MODULES FILES
module/sqlpp23.test.mysql.tables.cppm
modules/sqlpp23.test.mysql.tables.cppm
)
target_link_libraries(sqlpp23.test.mysql.tables.module PUBLIC sqlpp23.core.module)
endif()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module;

// clang-format off
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/mysql/tables.sql --path-to-module tests/mysql/module/sqlpp23.test.mysql.tables.cppm --namespace test --assume-auto-id --module-name sqlpp23.test.mysql.tables --generate-table-creation-helper
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/mysql/tables.sql --path-to-module tests/mysql/modules/sqlpp23.test.mysql.tables.cppm --namespace test --assume-auto-id --module-name sqlpp23.test.mysql.tables --generate-table-creation-helper

#include <optional>

Expand Down
2 changes: 1 addition & 1 deletion tests/postgresql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(BUILD_WITH_MODULES)
target_sources(sqlpp23.test.postgresql.tables.module
PUBLIC
FILE_SET all_my_modules TYPE CXX_MODULES FILES
module/sqlpp23.test.postgresql.tables.cppm
modules/sqlpp23.test.postgresql.tables.cppm
)
target_link_libraries(sqlpp23.test.postgresql.tables.module PUBLIC sqlpp23.core.module)
endif()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module;

// clang-format off
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/postgresql/tables.sql --path-to-module tests/postgresql/module/sqlpp23.test.postgresql.tables.cppm --namespace test --assume-auto-id --module-name sqlpp23.test.postgresql.tables --generate-table-creation-helper
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/postgresql/tables.sql --path-to-module tests/postgresql/modules/sqlpp23.test.postgresql.tables.cppm --namespace test --assume-auto-id --module-name sqlpp23.test.postgresql.tables --generate-table-creation-helper

#include <optional>

Expand Down
2 changes: 1 addition & 1 deletion tests/sqlite3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(BUILD_WITH_MODULES)
target_sources(sqlpp23.test.sqlite3.tables.module
PUBLIC
FILE_SET all_my_modules TYPE CXX_MODULES FILES
module/sqlpp23.test.sqlite3.tables.cppm
modules/sqlpp23.test.sqlite3.tables.cppm
)
target_link_libraries(sqlpp23.test.sqlite3.tables.module PUBLIC sqlpp23.core.module)
endif()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module;

// clang-format off
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/sqlite3/tables.sql --path-to-module tests/sqlite3/module/sqlpp23.test.sqlite3.tables.cppm --namespace test --assume-auto-id --module-name sqlpp23.test.sqlite3.tables --generate-table-creation-helper
// generated by ./scripts/sqlpp23-ddl2cpp --path-to-ddl tests/include/sqlpp23/tests/sqlite3/tables.sql --path-to-module tests/sqlite3/modules/sqlpp23.test.sqlite3.tables.cppm --namespace test --assume-auto-id --module-name sqlpp23.test.sqlite3.tables --generate-table-creation-helper

#include <optional>

Expand Down