Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Version of adding -std=c99 that works in cmake 3.2.2 #2

Open
alito wants to merge 1 commit into
openai:masterfrom
alito:stdc99
Open

Version of adding -std=c99 that works in cmake 3.2.2 #2
alito wants to merge 1 commit into
openai:masterfrom
alito:stdc99

Conversation

@alito

@alito alito commented Apr 29, 2016

Copy link
Copy Markdown

Comments refer to 9b13f2b :

The 'list(APPEND CMAKE_C_FLAGS "-std=c99")' line in pachi_py/pachi/CMakelists.txt causes cmake to emit a semi-colon before that part, breaking the build (ie

make VERBOSE=1
/usr/bin/cmake -H/usr/src/machinelearning/pachi-py/pachi_py/pachi -B/usr/src/machinelearning/pachi-py/pachi_py/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /usr/src/machinelearning/pachi-py/pachi_py/build/CMakeFiles /usr/src/machinelearning/pachi-py/pachi_py/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/usr/src/machinelearning/pachi-py/pachi_py/build'
make -f CMakeFiles/pachi.dir/build.make CMakeFiles/pachi.dir/depend
make[2]: Entering directory '/usr/src/machinelearning/pachi-py/pachi_py/build'
cd /usr/src/machinelearning/pachi-py/pachi_py/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /usr/src/machinelearning/pachi-py/pachi_py/pachi /usr/src/machinelearning$
make[2]: Leaving directory '/usr/src/machinelearning/pachi-py/pachi_py/build'
make -f CMakeFiles/pachi.dir/build.make CMakeFiles/pachi.dir/build
make[2]: Entering directory '/usr/src/machinelearning/pachi-py/pachi_py/build'
/usr/bin/cmake -E cmake_progress_report /usr/src/machinelearning/pachi-py/pachi_py/build/CMakeFiles 1
[  2%] Building C object CMakeFiles/pachi.dir/board.c.o
/usr/bin/cc   -O2 -march=native -mtune=native ;-std=c99 -O3 -DNDEBUG -I/usr/src/machinelearning/pachi-py/pachi_py/pachi    -fPIC "-D_GNU_SOURCE -Wall -Wextra -Wno-unused-functio$
cc: fatal error: no input files

Note the semi-colon in between -mtune=native and -std=c99 on the second last line. This is probably due to version-specific differences in cmake. I'm running cmake 3.2.2 (Ubuntu 15.10).

Patch changes it to code that should work on older and newer versions of cmake taken from David Grayson on stackoverflow (http://stackoverflow.com/questions/24840030/forcing-c99-in-cmake-to-use-for-loop-initial-declaration)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant