conan-io / conan-center-index

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

[bison] Mimic CMake's 'FindBISON.cmake' #1814

Open jgsogo opened 4 years ago

jgsogo commented 4 years ago

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

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

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

madebr commented 4 years ago

Does conan have a way to set cmake variables? BISON_EXECUTABLE is needed.

jgsogo commented 4 years ago

We can add files to build_modules and Conan will include them. I suppose we can set that variable there

ericLemanissier commented 4 years ago

@jgsogo What do you suggest for the BISON_TARGET macro ? should we re-implement it in this cmake file too ?

madebr commented 4 years ago

I think, the script should look like this:

include("${CMAKE_ROOT}/Modules/FindBISON.cmake")

We want this script to only be included in the cmake_find_package and cmake_find_package_multi generator. Will this script also be included in the cmake generator?

Croydon commented 3 months ago

This is likely solved by now https://github.com/conan-io/conan-center-index/blob/a94c0f01578ba26a1b9bba7d6e35f245d0873da7/recipes/bison/all/conanfile.py#L149

Croydon commented 1 month ago

@jgsogo What do you suggest for the BISON_TARGET macro ? should we re-implement it in this cmake file too ?

That is still a problem which just hit me. Didn't read the comment last time I commented in this issue, sorry.

I am not sure how to solve it.

Bison itself is not using CMake, but CMake's official FindBISON is declaring the BISON_TARGET macro and projects do rely on it

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

Croydon commented 1 month ago

It isn't too small either https://github.com/conan-io/conan-center-index/issues/1814#issuecomment-2127285311

Probably could be simplified a bit, but every chance might cause it to behave differently.