Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sln file generated by cmake should be called "glog.sln" instead of "google-glog.sln" #149

Closed
jasjuang opened this issue Dec 30, 2016 · 9 comments
Labels

Comments

@jasjuang
Copy link

I am on windows 10 with visual studio 2015. When I go through the standard procedure of

git clone https://github.com/google/glog/
mkdir build 
cd build
cmake -A x64 ..

It generates a solution file called google-glog.sln. The problem is when I build the entire solution and build the INSTALL project, glog got installed to C:\Program Files (x86)\google-glog

but

in other google created repository Ceres it is expecting glog to be installed in C:\Program Files (x86)\glog, thus causing it to fail. Can someone change the default name of the sln to glog.sln?

@sergiud
Copy link
Collaborator

sergiud commented Dec 30, 2016

You're mixing up two things. The project name and the install location. You want to default the install location on Windows to %PROGRAMFILES%\glog. No need to change the project name. You can also change the install location by setting the CMAKE_INSTALL_PREFIX CMake variable to the desired directory.

And what exactly fails in your case?

@jasjuang
Copy link
Author

jasjuang commented Dec 30, 2016

Yes I understand I can change CMAKE_INSTALL_PREFIX in cmake-gui to fix this problem, but the problem is I have to install this in multiple computers and it will be great if this can be automatic.

It fails when I am configuring Ceres with cmake. The FindGlog.cmake in Ceres is expecting glog to be installed in C:\Program Files (x86)\glog instead of C:\Program Files (x86)\google-glog.

Also I am making the assumption that the sln name and the install folder will be the same by default, other libraries like Eigen, Gflags all behaved this way.

@sergiud
Copy link
Collaborator

sergiud commented Dec 30, 2016

Since you run CMake anyway, you can automate the process by setting CMAKE_INSTALL_PREFIX using the command line:

cmake <glogdir> -DCMAKE_INSTALL_PREFIX=...

@jasjuang
Copy link
Author

jasjuang commented Dec 30, 2016

This workaround is acceptable but still slightly inconvenient. Just wondering, what is the main reason that it's not desired to change from google-glog to glog? I filed an issue on Ceres and hopefully they will change if glog is not willing to change. There has to be consistency between Ceres and glog since both are all from Google.

@sergiud
Copy link
Collaborator

sergiud commented Dec 30, 2016

There are no critical reasons besides that this would require to change project's name making it inconsistent with the already provided Visual Studio solution.

However, in general I agree that the install location should default to %PROGRAMFILES%\glog which would help find_package mechanism to automatically locate glog.

@jasjuang
Copy link
Author

Thanks. I look forward to the update of changing the default install location to %PROGRAMFILES%\glog.

@jasjuang
Copy link
Author

jasjuang commented Jan 2, 2017

Ceres was able to accommodate and add in another search option for %PROGRAMFILES%\google-glog, but I still feel naming it %PROGRAMFILES%\glog is more right though

@alexsmac
Copy link
Contributor

alexsmac commented Jan 6, 2017

Hi, as one of the Ceres' maintainers I thought I would add my 2c here. In general, CMake best-practice is that the project() name should really match the installed name for precisely this reason, so I think the correct solution is to change project(google-glog) to project(glog).

An interim solution for clients is to use the NAMES option to find_package() as follows:

find_package(glog NAMES google-glog glog)

this forces find_package() to repeat the search of all prefixes using the names 'google-glog' and 'glog' when expanding each prefix. Unfortunately both must be specified, as 'google-glog' is required for Windows (by default) and 'glog' is required for all other OSs.

I've pushed a CL for Ceres which does exactly this, once we have confirmation from @jasjuang that it works on Windows (as none of the Ceres maintainers use Windows) we will merge it.

keir pushed a commit to ceres-solver/ceres-solver that referenced this issue Jan 6, 2017
- glog has a bug in its CMakeLists.txt whereby it uses ‘google-glog’ as
  its project() name in its CMakeLists.txt, but exports itself as ‘glog’
  which results in an install prefix on Windows which contains
  ‘google-glog’ instead of ‘glog’ which breaks find_package(glog).
  This has been raised as a glog issue here:
  google/glog#149.
- We now force find_package(glog) to search glog using both
  ‘google-glog’ (for Windows) & ‘glog’ (for all other OSs).

Change-Id: I6c0edccdec405200eaa0fea1476b574e73bd3f14
@sergiud
Copy link
Collaborator

sergiud commented Jan 10, 2017

Fixed in #152.

@sergiud sergiud added the bug label Oct 24, 2017
@sergiud sergiud closed this as completed Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants