Here is the warning currently being produced:
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.19/Modules/GNUInstallDirs.cmake:223 (message):
Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
target architecture is known. Please enable at least one language before
including GNUInstallDirs.
Call Stack (most recent call first):
I noted how I fixed the error. This is caused by GNUInstallDirs automatically executing code just by including it.
I also added -Werror=dev to the CI to ensure this never happens again.
Co-authored-by: Juan Ramos <juanr0911@gmail.com>
* Cmake Revamp
I needed to do a variety of things to ensure cxxopts worked well in my own project.
I created a new cmake module to abstract a lot of the logic in the main CMakelists.txt, I think it really assists in the readability of the project. Consequently a lot of logic is now written in functions.
I made a lot of the project options off by default unless the project is being built standalone. As a frequent consumer of cmake libraries this is a huge issue. Since examples, tests, installation, etc. aren't things I expect/desired by default when using libraries.
Co-authored-by: Juan Ramos <juanr0911@gmail.com>
This speeds up the CMake configuration step by not searching for a C
compiler. By default, CMake looks for C and C++ compilers, unless a set
of compilation languages is specified.
* remove biicode support
The company/startup died in 2015 and the open source project seems
to be dead as well.
* define compiler warning flags globally instead of locally for every binary
* add support for cmake's find_package() (refs #52)
This rewrite of the main CMakeLists.txt cleans up the way ICU flags
are attached to the library target and adds the cmake helper files
(cxxopts-config.cmake, cxxopts-config-version.cmake,
cxxopts-targets.cmake) which are needed for exporting the cxxopts
target. Cmake's find_package command uses these files when the
library is consumed by another project.
Additionally, two new tests have been added which build the example
application via add_subdirectory and find_package.
* removed target_sources from interface library
Adding target_sources to interface libraries and exporting them is
not supported in CMake 3.1 and 3.2. Furthermore, since it is a header,
it is not needed at all.
* use the *_LDFLAGS instead of *_LIBARIES when linking ICU
The LIBRARIES variable seems to contain only the name and not the
full path.
Fixes#50. This enables -Wall -Wextra -Wshadow and sets -Werror so that
the build fails if there are any warnings. All warnings that came up are
also fixed
Fixes#33.
This PR uses cmake's interface library feature:
An INTERFACE library target does not directly create build output,
though it may have properties set on it and it may be installed,
exported and imported.
This makes it easier to include the header only library in a cmake
project. After using add_subdirectory on the cxxopts directory, one
simply needs to include cxxopts in their target_link_libraries, which
will allow the user's target to inherit the properties of the cxxopts
header library (see changes to example and test).
* Add cxxopts.hpp as a source file to executable
* Add msvc options for compiling
* Add CXXOPTS_BUILD_EXAMPLES option to CMake build
* This is helpful when using CMake's ExternalProject_add()
* It is ON by default, but configurable from the command-line.