Skip to content

Rename some CMake files and functions #138

Description

@rbock

Taken from #137 (thanks @MeanSquaredError)

The existing file sqlpp23_target_helper.cmake exports two functions to the outside callers:

add_core
add_component

(when I say that these two functions are "exported" I just mean that they are to be called from outside)

That same file also defines several internal macros/functions which are used by the above two exported functions, namely:

set_if
add_regular_and_module
add_common

If I were to put add_testing_target into that common file, then given that CMake doesn't have an established way to mark exported and internal functions, it would become a bit difficult for the code maintainer to understand which function is exported to be called from outside and which is for internal calling only.

Also I think that further optimizations of the testing code might move other functions into sqlpp23_testing_helper.cmake. For example currently multiple test subdirs define functions like

create_test
test_assert
create_test_for_setup

I think that these functions (and maybe other similar ones) should be moved into sqlpp23_testing_helper.cmake in order to avoid the current code duplication.

However if we move all these functions into one file (sqlpp23_target_helper.cmake), I think it will becomes even more confusing especially given that we have no way of separating the exported and internal functions.

For that reason I think that it makes sense to have two separate files with common functions: one file for the build/install targets and another for the test targets. However I think that it may make some sense to rename the files and/or the functions inside. E.g. we could rename:

sqlpp23_target_helper.cmake -> sqlpp23_build_targets.cmake
sqlpp23_testing_helper.cmake -> sqlpp23_testing_targets.cmake

and also rename the functions like this

add_core -> add_build_core
add_component -> add_build_component
add_testing_target - This one probably doesn't need renaming?

These are just my thoughts, though, so any thoughts and suggestions on the matter are welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions