Currently CMake scripts will generate both dynamic and static libraries
at the same time. However, CMake recommends using BUILD_SHARED_LIBS to
build either dynamic or static library, which is enforced by vcpkg.
Use BUILD_SHARED_LIBS to build one library type at a time, so that
developers can use vcpkg manifest mechanism to install Argtable3.
We also add namespace (argtable3::) to the package and generate CMake
config version file (Argtable3ConfigVersion.cmake), which can be used to determine the library version in find_package().
Add a CMake setting ARGTABLE3_LONG_ONLY to use getopt_long_only in
dynamic and static libraries. By default it is OFF. To turn on the
setting:
$ cmake -DARGTABLE3_LONG_ONLY=ON ..
Add a C macro ARG_LONG_ONLY to use getopt_long_only in ordinary source
distribution and amalgamation distribution.
resolves#57
Switching to FreeBSD getopt library can resolve two issues:
1. FreeBSD getopt always uses the 2-Clause BSD, which is compatible
to GPL. (Although NetBSD has switched to the 2-Clause BSD in
2008.)
2. FreeBSD getopt_long provides getopt_long_only, which is critical
for developers who want to follow the command-line syntax
convention, which uses a single '-' character for long options.
resolves: #54#56
We didn't notice that using add_compile_definitions will force
developers upgrading their CMake to 3.12. Go back using the old
add_definitions() so we can keep using CMake 3.0.
resolves: #48
With target_compile_definitions(argtable3 INTERFACE argtable3_IMPORTS)
in src/CMakeLists.txt, we no longer have to explicitly specify
-Dargtable3_IMPORTS.
With the new CMake script, we can generate four types of library:
shared, static, original source, and amalgamation source. We add tests
to make sure all library types can work correctly.
We've also solved several issues related to Linux/Windows build errors.
The CMake script can generate the amalgamation distribution, and we can
choose whether to use the amalgamation or not.