martinmoene/expected-lite

CMake variable package_name makes it impossible to use expected-lite with variant-lite in one source tree

rmorozov opened this issue · 3 comments

Hello Martin!

set( package_name "${unit_name}-lite" CACHE STRING "Name of the package" )

Tried to update third_parties in https://github.com/flexferrum/Jinja2Cpp/tree/master/thirdparty/nonstd to latest, in order to get basic cmake package support, but making package_name CACHE variable caused CMake errors when variant-lite tries to call add_library after adding expected-lite .

add_library cannot create target "expected-lite" because another target
with the same name already exists. The existing target is an interface
library created in source directory

Could you please fix scenario when someone wants to build several of your libraries using your CMakes?

Maybe it is better not to make package_name CACHE variable but CMake option instead. Also there could be possibility of name clash with CMAKE variable package_name declared in upper CMakes. So I would rather call it expected_lite_package_name?

Ah, I see, thanks.

I chose to duplicate the unit name in test/CMakeLists.txt and approach it like:

Note that the namespace changed from expected-lite::, optional-lite:: etc. to nonstd .

B.t.w. option() can only be used for boolean values.

B.t.w. option() can only be used for boolean values.

Sorry missed that point=)

I think this one can be closed.