CMakeã§ããã©ã«ãã®ã³ã³ãã¤ã©ãæ¸ãæããå¾®å¦ãªæ¹æ³
ããã¾ãã¦ããã§ã¨ããããã¾ãã
å¹´ãæãã¦2é±éã»ã©çµã¡ã¾ãã¦ãä»å¹´æåã®æ´æ°ã¯ã¾ããã¦ãCMakeãã¿ã§ãã以ä¸è¨èªã¯C++ãä¾ã¨ãã¦ããã¾ãã®ã§ãããããã
ãã¦ãã³ã³ãã¤ã©ãªããã¯ãããªã«è¨å®ãã¦ãããCMakeã§ãããæã«ãããæ°ã«å
¥ããªãå ´åãããã¾ããä¾ãã°â¦
- Macã®g++ã¯å¤ãã®ã§ã¨ãããC++11使ãããã®ã§clang++ããã
- ã¹ãã³ã³çã§g++ãããªãã¦ãã³ããããæå®ãã¦ãã³ã³ãã¤ã©ã使ããã
ãªããg++ãã£ã¹ã£ã¦ãã¿ããã«è¦ãã¾ãããããªãã¨ã¯ãªãã§ããï¼ã¡ãã»ã¼ã¸ã¯clangã®æ¹ã親åã ãã©ããªãã 試ãããæé©åè½åã¯g++ã®æ¹ãé«ãã£ããï¼
ã§ãæ®éã®æ¹æ³ãã®1ãCMakeå©ãã¨ãã«ã»ãããã¾ãã
cmake -DCMAKE_CXX_COMPILER=clang++
ãã¡ãã¡ãããªã®ã¿ã¤ããã¦ãããªãããã·ã§ã«ã®å±¥æ´ä½¿â¦ã²ãã³ã²ãã³â¦
ã§ã¯æ®éã®æ¹æ³ãã®2ãç°å¢å¤æ°ãã»ãããã¾ãã
export CXX=clang++
ã·ã§ã«ã®è¨å®ã«æ¸ãã¦ããã°ãã¡ãã¡ã¿ã¤ãããã«æ¸ã¿ã¾ãããï¼ã¿ã¤ãããããªããã©ä»ã¯g++使ãããã ã£ã¦ï¼ããã ããã·ã§ã«ã®å±¥â¦ã²ãã³ã²ãã³â¦
ãããããªãã®ã§å¾®å¦ãªæ¹æ³ãCMakeLists.txtåé ã§ãã«ããã«ããã¾ãã
project(dummy NONE) if(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(CMAKE_CXX_COMPILER clang++) endif() project(myproject CXX)
å
ã«è¨èªãæå¹ã«ããªãdummyããã¸ã§ã¯ãã§CMAKE_SYSTEM_NAMEã使ããããã«ãã¦ç°å¢ãå¤å¥ãã³ã³ãã¤ã©ãæ¸ãæãã¾ããä¸ã®ä¾ã§ã¯Macãªãåçç¡ç¨ã§clang++ã使ãã¾ãã
ãã ã¦ã¼ã¶ã¼ããããããªãã®ãªãããã©ã«ãã®æåãåæã«å¤æ´ããã®ã¯ã¡ããã¨èãç©ããããããã¯ã俺æ°ããg++å
¥ãã¦ã£ããC++11使ãããããã£ã¦åæã«clang++ã«ãããããã¼ããã¨ããæ¹åãã«ON/OFFãªãã·ã§ã³ãä»ããã®ãä¸èãã¨æãã¾ããèªåã ãã§ä½¿ãåã«ã¯ãã£ã¡ããã°ããã¨æãã¾ããã
ãªã以ä¸ã®ãã¿å
ã¯ä¾ã«ãã£ã¦CMakeã®MLããOrder of operations in CMakeLists.txt file?ã§ããã