summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBaruch Sterin <baruchs@gmail.com>2015-10-21 22:56:15 -0700
committerBaruch Sterin <baruchs@gmail.com>2015-10-21 22:56:15 -0700
commit9b3a358e6fba7ee6bd4811ed95f3c8c62e056152 (patch)
tree7f86a03f848f51a04b3cac754457afabe6f3fd97 /CMakeLists.txt
parent28f2063caa7fb8864a63622a40f54bb70d1be08e (diff)
downloadabc-9b3a358e6fba7ee6bd4811ed95f3c8c62e056152.tar.gz
abc-9b3a358e6fba7ee6bd4811ed95f3c8c62e056152.tar.bz2
abc-9b3a358e6fba7ee6bd4811ed95f3c8c62e056152.zip
Makefile: Add a CMakeLists.txt that uses the regular Makefile to compute flags and source file. This is a ugly hack, mainly to allow the use of CLion with ABC. Include some changes in the Makefile to support that.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..09bf5016
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.1.0)
+
+project(abc)
+
+execute_process(
+ COMMAND make ABC_MAKE_NO_DEPS=1 cmake_info
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE MAKE_OUTPUT
+)
+
+function(extract_var SEPARATOR DEST_VARIABLE MAKE_OUTPUT)
+
+ string(REGEX MATCH "${SEPARATOR} .* ${SEPARATOR}" TMP "${MAKE_OUTPUT}")
+ string(REGEX REPLACE "${SEPARATOR} (.*) ${SEPARATOR}" "\\1" TMP "${TMP}")
+
+ separate_arguments(TMP)
+
+ set(${DEST_VARIABLE} ${TMP} PARENT_SCOPE)
+
+endfunction()
+
+extract_var(SEPARATOR_SRC ABC_SRC ${MAKE_OUTPUT})
+extract_var(SEPARATOR_LIBS ABC_LIBS ${MAKE_OUTPUT})
+extract_var(SEPARATOR_CFLAGS ABC_CFLAGS ${MAKE_OUTPUT})
+
+add_executable(abc ${ABC_SRC})
+
+target_include_directories(abc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src )
+target_compile_options(abc PRIVATE ${ABC_CFLAGS} )
+target_link_libraries(abc PRIVATE ${ABC_LIBS})