seznam / SuperiorMySqlpp

SuperiorMySQL++
GNU Lesser General Public License v3.0
31 stars 20 forks source link

an cmake issue #139

Closed estrellaFZTH closed 1 year ago

estrellaFZTH commented 1 year ago

.... -- Found Threads: TRUE
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: system -- Configuring done CMake Error at tests/odr/CMakeLists.txt:15 (add_library): No SOURCES given to target: test_odr

CMake Generate step failed. Build files cannot be regenerated correctly.

estrellaFZTH commented 1 year ago

How to solve this, please?

OpatrilPeter commented 1 year ago

Hello.

The immediate problem is clear. There is a One Definition Rule (ODR) test defined here that collects list of headers from this library and generates dummy *.cc out of them. But no such files are found, the result of "${CMAKE_CURRENT_SOURCE_DIR}/../../include/*.hpp" glob executed from tests/odr/ directory appears to be empty.

To reproduce and understand the issue further, we'd need to know more details about setup of your build, it is likely not the one in the README.

What version of cmake are you running? On what OS? How exactly did you invoke the cmake? If you're using this library inside your project, how did you integrate them (something like git submodule with add_subdirectory inside your project or something else? The contents of CMakeCache.txt could also help. Please, share any detail that might be relevant.

In any case, the ODR test is optional and can be turned off by setting the appropriate flag - -DTEST_ODR_ENABLED=OFF should work from the CLI.

estrellaFZTH commented 1 year ago

I ran it again today. It worked. It was amazing. My Os is Ubuntu 20.04, cmake version is 3.24.1. Thank you for you help and reply.

OpatrilPeter commented 1 year ago

Great to hear, I'll close this now.

General tip for the future: Sometimes, it's possible to get cmake in wrong state where it doesn't work even if it previously did, because it caches things between runs. Cleaning the cmake's build directory and starting from scratch usually helps and could be faster than investigating the problem proper.