conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
960 stars 1.77k forks source link

[flex] Mimic CMake 'FindFLEX.cmake' #1813

Open jgsogo opened 4 years ago

jgsogo commented 4 years ago

CMake provides its own FindFLEX.cmake file, we probably should mimic the variables exposed but this module file:

https://cmake.org/cmake/help/latest/module/FindFLEX.html

At least it is used by thrift (https://github.com/conan-io/conan-center-index/pull/1700#discussion_r434387841)

ericLemanissier commented 4 years ago

that's another instance of https://github.com/conan-io/conan-center-index/issues/419 Conan does not currently provide a way to add some variables to generated files right ? Also, to truly fix this, the generator would need to create cmake macro: FLEX_TARGET. Maybe the most reasonable thing would be to not generate the FindFLEX.cmake at all. It should be acceptable because we know for a fact that cmake itself provides this file, and that it works.

SSE4 commented 4 years ago

I have the same feeling, it's useless to mimic FindFLEX.cmake as there is already built-in one.

jgsogo commented 4 years ago

Conan will generate a file for every dependency, we can't list some dependencies and not generate files for them, and I don't see consumers removing these files.

Conan does not currently provide a way to add some variables to generated files right?

Yes, we can add files to build_modules and these files will be automatically included by Conan, so we can recreate these variables and macros in the Conan generated files.


And yes, there is another consideration here: how to deal with FindXXXX.cmake files that we know for a fact that CMake provides. Not only for flex/bison but for any of them.

ericLemanissier commented 4 years ago

Conan does not currently provide a way to add some variables to generated files right?

Yes, we can add files to build_modules and these files will be automatically included by Conan, so we can recreate these variables and macros in the Conan generated files.

those kind of files are not allowed in conan-center-index right ?

Regarding the non-generation of files for certain recipes, they could declare self.cpp_info.names["foo"] = None

SSE4 commented 4 years ago
Conan will generate a file for every dependency, we can't list some dependencies and not generate files for them, and I don't see consumers removing these files.

it's valid point, but conan doesn't dictate you to use all the files generated. conan just generates the files and give the complete freedom to you, e.g. it's up to consumer if use all of them, some of them or even none of them.

jgsogo commented 4 years ago

Conan does not currently provide a way to add some variables to generated files right?

Yes, we can add files to build_modules and these files will be automatically included by Conan, so we can recreate these variables and macros in the Conan generated files.

those kind of files are not allowed in conan-center-index right ?

Regarding the non-generation of files for certain recipes, they could declare self.cpp_info.names["foo"] = None

Yes, they are allowed, you can find some of them (WIP) in the protobuf package for example, pybind11 should have too


Conan will generate a file for every dependency, we can't list some dependencies and not generate files for them, and I don't see consumers removing these files.

it's valid point, but conan doesn't dictate you to use all the files generated. conan just generates the files and give the complete freedom to you, e.g. it's up to consumer if use all of them, some of them or even none of them.

IMO, we are asking too much to the final user, he will see a file FindFLEX.cmake and he will wonder why this one is not valid if all the other files generated by Conan are. And the same mental process applies to every requirement. A suggestion like the one by @ericLemanissier would be needed (and the user will wonder why that requirement doesn't generate the file).