aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/VendorConfig.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/cmake/VendorConfig.cmake b/cmake/VendorConfig.cmake
new file mode 100644
index 0000000..42e72c8
--- /dev/null
+++ b/cmake/VendorConfig.cmake
@@ -0,0 +1,49 @@
+string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME)
+
+if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config")
+ message(FATAL_ERROR "No vendor config for ${SYSTEM_NAME}: ${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config is missing")
+endif()
+
+# the .config has been found
+
+# read .config entries that start with CONFIG_ to a list of strings
+file(STRINGS ${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config vendor_config REGEX "^CONFIG_")
+
+# for every item in the list, turn it into a list and set it
+foreach(item IN LISTS vendor_config)
+ #message("${item}")
+ string(REPLACE "\"" "" item ${item})
+ string(REGEX REPLACE "(^CONFIG_[^=]*)=(.*$)" "\\1;\\2" item_list ${item})
+ #message("${item_list}")
+ set(${item_list})
+endforeach()
+
+# Compiler settings
+# Compiler flags
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CONFIG_CXX_FLAGS} ${CONFIG_CXX_FLAGS_DEBUG}")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CONFIG_CXX_FLAGS} ${CONFIG_CXX_FLAGS_RELEASE}")
+
+# Install paths
+set(CMAKE_INSTALL_PREFIX ${CONFIG_INSTALL_PREFIX})
+
+## Version information, used in src/version.h.in
+if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
+ execute_process(COMMAND git rev-list --count HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerShortId OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+set(poi_Version "r${VerRevision}" CACHE STRING "Short version string")
+set(poi_Describe "r${VerRevision}-${VerShortId}" CACHE STRING "Long version string")
+set(poi_Build "${VerBranch}-${VerCommit}" CACHE STRING "Build string")
+
+# linking to libc++ doesn't work
+if (CONFIG_LLVMLIBCPP)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
+endif (CONFIG_LLVMLIBCPP)
+
+if(CONFIG_QTWARNINGS)
+ add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900)
+endif(CONFIG_QTWARNINGS)