Fix cmake build / update CMakeLists.txt to use C++11 #887

Closed
shawwn wants to merge 1 commits from 2019-04-12/fix-cmake into master
shawwn commented 2019-04-12 15:12:58 -07:00 (Migrated from github.com)

On MacOS, the following steps result in build errors:

mkdir build
cd build
cmake ..
make

The problem is that yogacore uses C++11 features (constexpr) but C++11 isn't specified in CMakeLists.txt.

This PR solves the poblem by adding the following code to the bottom of CMakeLists.txt:

set_target_properties(yogacore PROPERTIES CXX_STANDARD 11)

This solution was derived from https://stackoverflow.com/questions/45688522/how-to-enable-c17-in-cmake

On MacOS, the following steps result in build errors: ``` mkdir build cd build cmake .. make ``` The problem is that yogacore uses C++11 features (`constexpr`) but C++11 isn't specified in CMakeLists.txt. This PR solves the poblem by adding the following code to the bottom of CMakeLists.txt: ``` set_target_properties(yogacore PROPERTIES CXX_STANDARD 11) ``` This solution was derived from https://stackoverflow.com/questions/45688522/how-to-enable-c17-in-cmake
shawwn commented 2019-04-12 22:24:16 -07:00 (Migrated from github.com)

I notice yoga's javascript binding requires C++14. Would it make sense for me to change this PR to C++14 instead of C++11?

I went with the minimum C++ version that seemed to work. But if C++14 would be more future-proof, we should go with that instead.

I notice yoga's javascript binding requires C++14. Would it make sense for me to change this PR to C++14 instead of C++11? I went with the minimum C++ version that seemed to work. But if C++14 would be more future-proof, we should go with that instead.
davidaurelio commented 2019-05-14 04:36:18 -07:00 (Migrated from github.com)

C++11 is fine for now, thanks for the fixes!

C++11 is fine for now, thanks for the fixes!
facebook-github-bot (Migrated from github.com) reviewed 2019-05-14 04:36:29 -07:00
facebook-github-bot (Migrated from github.com) left a comment

@davidaurelio is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@davidaurelio is landing this pull request. If you are a Facebook employee, you can view this diff [on Phabricator](https://phabricator.internmc.facebook.com/D15334282).
facebook-github-bot commented 2019-05-14 07:23:26 -07:00 (Migrated from github.com)

@davidaurelio merged this pull request in facebook/yoga@afc1108659.

@davidaurelio merged this pull request in facebook/yoga@afc1108659074fdfa1e51545e65ed8d444096bd4.

Pull request closed

Sign in to join this conversation.
No description provided.