-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Enable c++11 support through CMake functions. #464
Conversation
Thanks so much for this! A quick check: http://packages.ubuntu.com/trusty/cmake cmake on 14.04 is actually still 2.8, so do you think it is possible for us to provide a backward compatible path for folks who have an older cmake? |
@hgaiser updated the pull request - view changes |
Ah .. 14.04 is a target platform for caffe2? I suppose it makes sense since it's a LTS, but it can be annoying in cases such as this. I suppose there are two options then, merge this PR and provide people a guide to upgrade cmake in Ubuntu 14.04 or don't merge this PR and keep it the way it was. ps. I just updated this PR to also set the |
@hgaiser I found that one can potentially use this to do cross version support. Would you like to give that a shot? if(CMAKE_VERSION VERSION_LESS "3.1") |
Similar to the discussion here, having cross version support in my opinion defeats the purpose of this PR. This PR is intended to use a cleaner method of choosing CXX standard, but if both are still present it only adds unnecessary complexity. My advise would be to drop official support for Ubuntu 14.04 (it's over 3 years old ;) ) and provide a guide for installing cmake >3.1 if necessary. The alternative is to ignore this PR in favor of support on Ubuntu 14.04. |
@Yangqing what is the verdict? |
@hgaiser I asked around a little bit and seems that Cmake <3.0 is still something preferred... so maybe let's keep the old way? It's definitely not very ideal and I in fact recommend putting the backward-compatible, but newer approach for 3.1 :) |
This PR replaces PR facebookarchive#464. It requires C+11 support using the new CMake variables (CMAKE_CXX_STANDARD, CMAKE_CXX_STANDARD_REQUIRED, etc.) when CMake is version 3.1 or above. Otherwise, if CMake is older (e.g. Ubuntu 14.04) it falls back to using the -std=c++11 flag and issues a warning. This PR is based on the comment from @Yangqing: facebookarchive#464 (comment) The corresponding line in cmake/MiscCheck.cmake is removed in order to reduce redundancy.
This PR replaces PR facebookarchive#464. It requires C+11 support using the new CMake variables (CMAKE_CXX_STANDARD, CMAKE_CXX_STANDARD_REQUIRED, etc.) when CMake is version 3.1 or above. Otherwise, if CMake is older (e.g. Ubuntu 14.04) it falls back to using the -std=c++11 flag and issues a warning. This PR is based on the comment from @Yangqing: facebookarchive#464 (comment) The corresponding line in cmake/MiscCheck.cmake is removed in order to reduce redundancy.
This PR replaces PR facebookarchive#464. It requires C+11 support using the new CMake variables (CMAKE_CXX_STANDARD, CMAKE_CXX_STANDARD_REQUIRED, etc.) when CMake is version 3.1 or above. Otherwise, if CMake is older (e.g. Ubuntu 14.04) it falls back to using the -std=c++11 flag and issues a warning. This PR is based on the comment from @Yangqing: facebookarchive#464 (comment) The corresponding line in cmake/MiscCheck.cmake is removed in order to reduce redundancy.
Closing in favor of #1027, thanks so much guys :) |
Summary: This PR replaces PR #464. It requires C+11 support using the new CMake variables (`CMAKE_CXX_STANDARD`, `CMAKE_CXX_STANDARD_REQUIRED`, etc.) when CMake is version 3.1 or above. Otherwise, if CMake is older (e.g. Ubuntu 14.04) it falls back to using the -std=c++11 flag and issues a warning. This PR is based on the comment from Yangqing: #464 (comment) The corresponding line in cmake/MiscCheck.cmake is removed in order to reduce redundancy. Another option would be to move the C++11 logic to MiscCheck.cmake. Closes #1027 Differential Revision: D5590646 Pulled By: Yangqing fbshipit-source-id: 11ac63fbeaab7a1da02115549e214f9c529f1873
Summary: This PR replaces PR #464. It requires C+11 support using the new CMake variables (`CMAKE_CXX_STANDARD`, `CMAKE_CXX_STANDARD_REQUIRED`, etc.) when CMake is version 3.1 or above. Otherwise, if CMake is older (e.g. Ubuntu 14.04) it falls back to using the -std=c++11 flag and issues a warning. This PR is based on the comment from Yangqing: facebookarchive/caffe2#464 (comment) The corresponding line in cmake/MiscCheck.cmake is removed in order to reduce redundancy. Another option would be to move the C++11 logic to MiscCheck.cmake. Closes facebookarchive/caffe2#1027 Differential Revision: D5590646 Pulled By: Yangqing fbshipit-source-id: 11ac63fbeaab7a1da02115549e214f9c529f1873
Summary: This PR replaces PR #464. It requires C+11 support using the new CMake variables (`CMAKE_CXX_STANDARD`, `CMAKE_CXX_STANDARD_REQUIRED`, etc.) when CMake is version 3.1 or above. Otherwise, if CMake is older (e.g. Ubuntu 14.04) it falls back to using the -std=c++11 flag and issues a warning. This PR is based on the comment from Yangqing: facebookarchive/caffe2#464 (comment) The corresponding line in cmake/MiscCheck.cmake is removed in order to reduce redundancy. Another option would be to move the C++11 logic to MiscCheck.cmake. Closes facebookarchive/caffe2#1027 Differential Revision: D5590646 Pulled By: Yangqing fbshipit-source-id: 11ac63fbeaab7a1da02115549e214f9c529f1873
This PR enables C++11 support using CMake variables (
CMAKE_CXX_STANDARD
for choosing the standard andCMAKE_CXX_STANDARD_REQUIRED
for disabling CMake's default functionality of "decaying" to c++98 if c++11 is not available).These variables are added since CMake 3.1.13 so a bump of the minimum required cmake version was necessary.