opensim-core icon indicating copy to clipboard operation
opensim-core copied to clipboard

Plugin cmake file has spurious variables

Open aymanhab opened this issue 4 years ago • 8 comments

CMakeLists.txt for plugins contain OPENSIM_INSTALL_DIR variable based on OPENSIM_HOME which has been abandoned since version 3.x and now leads to confusion, reported by users. image002

aymanhab avatar Jun 15 '20 21:06 aymanhab

The user had OpenSim 3.3 installed which may have contributed to the problem.

aymanhab avatar Jun 15 '20 21:06 aymanhab

This issue applies to all distributed examples' CMakeLists.txt, any reason to keep, @chrisdembia? It's a backdoor but it comes with much luggage that we better close in my opinion.

aymanhab avatar Jun 16 '20 15:06 aymanhab

No reason. It would be great to provide some hint as to what value to provide for OPENSIM_INSTALL_DIR.

chrisdembia avatar Jun 16 '20 16:06 chrisdembia

The issue in the above example is that the user chose a 32-bit generator; the issue above does not seem related to the OPENSIM_HOME environment variable.

chrisdembia avatar Jun 16 '20 16:06 chrisdembia

The user had VS 2015 so it may not have worked anyway, it is still the case however that the two CMake variables are confusing, even worse the fact that OPENSIM_HOME is used to populate one of them when we dropped it a year and a half ago and we have no plans to maintain.

aymanhab avatar Jun 16 '20 16:06 aymanhab

The two variables are confusing, but OpenSim_DIR (in general, <package>_DIR) is always generated by CMake; it tells you which package was actually found.

Typical usage of CMake is that users set CMAKE_PREFIX_PATH to the install directory of OpenSim. They can also set OpenSim_DIR to the location of OpenSimConfig.cmake.

I think it's too confusing for users to know to set OpenSim_DIR to the location of OpenSimConfig.cmake, and CMAKE_PREFIX_PATH is not defined by default.

I can update the examples to remove the use of the OPENSIM_HOME environment variable.

chrisdembia avatar Jun 16 '20 17:06 chrisdembia

Thanks @chrisdembia I think updating the example files to remove reference to OPENSIM_HOME as well as provide help to setting the variables would be a significant improvement. (The user was also confused between the OpenSim folder under Documents (where the examples are installed, and the actual Install folder so we need to be crystal clear). I can take a stab at it or we can pass on to others with some CMake experience to spread the knowledge.

aymanhab avatar Jun 16 '20 17:06 aymanhab

Hello @chrisdembia and @aymanhab , I have deleted all of the existing references in the code to OPENSIM_HOME in the following commit: ef3df5ea79e8859b8127d0f16cb49160c0876dad.

I've created the following pull request: #3300

AlbertoCasasOrtiz avatar Oct 14 '22 20:10 AlbertoCasasOrtiz