Check gcc minor in cmake

Use if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.2) as mentioned by onqtam. This obsolete answer was back from the 2.6 CMake days. You could run gcc -dumpversion and parse the output. Here is one way to do that: if (CMAKE_COMPILER_IS_GNUCC) execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) string(REGEX MATCHALL “[0-9]+” GCC_VERSION_COMPONENTS ${GCC_VERSION}) list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR) message(STATUS … Read more

Issue with Redis install “cc: Command not found”

wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable sudo apt-get install make sudo apt-get install gcc sudo apt-get install tcl sudo apt-get install build-essential sudo apt-get update ## if there is another error like “fatal error: jemalloc/jemalloc.h: No such file or directory” ## just run “make distclean” make make test

Selecting message language in gcc and g++

The end of the GCC manpage contains an overview of its locale environment variables: LANG LC_CTYPE LC_MESSAGES LC_ALL These environment variables control the way that GCC uses localization information that allow GCC to work with different national conventions. GCC inspects the locale categories LC_CTYPE and LC_MESSAGES if it has been configured to do so. These … Read more

Using GCC’s link-time optimization with static linked libraries

Here is an MCVE CMake project that reproduces the problem: $ ls -R hellow hellow: CMakeLists.txt hello.c libhello.c $ cat hellow/CMakeLists.txt cmake_minimum_required (VERSION 2.6) project (hellow) SET(CMAKE_C_FLAGS “${CMAKE_C_FLAGS} -flto”) SET(CMAKE_EXE_LINKER_FLAGS “${CMAKE_EXE_LINKER_FLAGS} -flto”) #SET(CMAKE_AR “gcc-ar”) #SET(CMAKE_C_ARCHIVE_CREATE “<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>”) #SET(CMAKE_C_ARCHIVE_FINISH true) add_library(hello STATIC libhello.c) add_executable(hellow hello.c) target_link_libraries(hellow hello) add_dependencies(hellow hello) $ cat hellow/hello.c extern … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)