diff --git a/CMakeLists.txt b/CMakeLists.txt
index d240c96768cadf33c54f7b524e63dd814754587b..85e575ada73a66ca7c61ea320ce321898b4a332b 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,9 @@
 cmake_minimum_required(VERSION 2.8)
-project (dap_chain_global_db)
+project (dap_chain_global_db C)
   
 file(GLOB DAP_CHAIN_GLOBAL_DB_SRC *.c)
 file(GLOB DAP_CHAIN_GLOBAL_DB_HDR *.h)
 
-add_subdirectory(libdap-cuttdb)
-
 if(WIN32)
   include_directories(../libdap/src/win32/)
   include_directories(../3rdparty/libmemcached/)
@@ -18,17 +16,20 @@ if(WIN32)
   include_directories(../3rdparty/libsqlite3/)
 endif()
 
+
 add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_GLOBAL_DB_SRC} ${DAP_CHAIN_GLOBAL_DB_HDR})
 
+add_subdirectory(libdap-cuttdb)
+
 if(WIN32)
-  target_link_libraries(dap_chain_global_db dap_core dap_crypto dap_chain dap_chain_crypto dap_cuttdb)
+  target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain dap_chain_crypto dap_cuttdb)
 endif()
 if(UNIX)
-  target_link_libraries(dap_chain_global_db dap_core dap_crypto dap_chain dap_chain_crypto ldb talloc tevent sqlite3 dap_cuttdb)
+  target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain dap_chain_crypto ldb talloc tevent sqlite3 dap_cuttdb)
 endif()
 
 target_include_directories(dap_chain_global_db INTERFACE .)
 
-set(${PROJECT_NAME}_DEFINITIONS CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE)
+#set(${PROJECT_NAME}_DEFINITIONS CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE)
 
-set(${PROJECT_NAME}_INCLUDE_DIRS ${PROJECT_SOURCE_DIR} CACHE INTERNAL "${PROJECT_NAME}: Include Directories" FORCE)
+#set(${PROJECT_NAME}_INCLUDE_DIRS ${PROJECT_SOURCE_DIR} CACHE INTERNAL "${PROJECT_NAME}: Include Directories" FORCE)
diff --git a/libdap-cuttdb/CMakeLists.txt b/libdap-cuttdb/CMakeLists.txt
index 4f309c1aba24d0fcb18a0f2658084ee0312894f6..9fe7f71758faf18bee2f15349a3aec708df1f81d 100644
--- a/libdap-cuttdb/CMakeLists.txt
+++ b/libdap-cuttdb/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 2.8)
 
-project(dap_cuttdb)
+project(dap_cuttdb C)
 
 add_definitions ("-D_GNU_SOURCE")
 set(CMAKE_C_FLAGS "-std=gnu11 -Wall -Wextra -fPIC")
@@ -9,18 +9,25 @@ file(GLOB cuttdb_src src/*.c)
 file(GLOB cuttdb_h src/*.h)
 
 # the server part ain't ported, and thus not built, so are tests.
-list(FILTER cuttdb_src EXCLUDE REGEX "ae.")
+list(FILTER cuttdb_src EXCLUDE REGEX "ae_")
+list(FILTER cuttdb_h EXCLUDE REGEX "ae_")
 list(FILTER cuttdb_src EXCLUDE REGEX "server.")
+list(FILTER cuttdb_h EXCLUDE REGEX "server.")
 list(FILTER cuttdb_src EXCLUDE REGEX "dump.")
+list(FILTER cuttdb_h EXCLUDE REGEX "dump.")
 list(FILTER cuttdb_src EXCLUDE REGEX "builddb.")
+list(FILTER cuttdb_h EXCLUDE REGEX "builddb.")
 list(FILTER cuttdb_src EXCLUDE REGEX "test_mt.")
+list(FILTER cuttdb_h EXCLUDE REGEX "test_mt.")
 
 if(UNIX)
-    list(FILTER cuttdb_src EXCLUDE REGEX "mman.")
+   list(FILTER cuttdb_src EXCLUDE REGEX "mman.")
     list(FILTER cuttdb_h EXCLUDE REGEX "mman.")
 endif()
 
-add_library(${PROJECT_NAME} STATIC ${cuttdb_h} ${cuttdb_src})
+add_library(${PROJECT_NAME} STATIC ${cuttdb_src} ${cuttdb_h})
+set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C)
+set_target_properties(${PROJECT_NAME} PROPERTIES COMPILER_LANGUAGE C)
 
 target_link_libraries(${PROJECT_NAME} -lpthread)
 
diff --git a/libdap-cuttdb/src/cdb_bgtask.c b/libdap-cuttdb/src/cdb_bgtask.c
index 822c02c1299c1f03fd5b738f50183e474dffce0a..da998c2b0a0f164350186c74e1bed80f95f5d633 100644
--- a/libdap-cuttdb/src/cdb_bgtask.c
+++ b/libdap-cuttdb/src/cdb_bgtask.c
@@ -61,7 +61,7 @@ static void *_cdb_bgtask_func(void *arg)
     CDBBGTASK *bt = (CDBBGTASK *)arg;
 #ifndef _WIN32
     /* block all signals coming into current thread */
-    _sigset_t smask;
+    sigset_t smask;
     sigfillset(&smask);
     pthread_sigmask(SIG_BLOCK, &smask, NULL);
 #endif