--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+project(bluesky)
+
+include(FindPkgConfig)
+pkg_check_modules(GLIB REQUIRED glib-2.0 gthread-2.0)
+
+link_directories(/home/mvrable/scratch/libs3-1.4/build/lib)
+
+add_library(bluesky SHARED dir.c inode.c store.c s3store.cc)
+add_executable(bluesky-test main.c)
+add_executable(nfsproxy
+ nfs3/nfsd.c nfs3/rpc.c nfs3/mount.c nfs3/nfs3.c
+ nfs3/mount_prot_xdr.c nfs3/nfs3_prot_xdr.c)
+
+#set_property(TARGET bluesky bluesky-test
+# APPEND PROPERTY COMPILE_FLAGS ${GLIB_CFLAGS})
+#set_property(TARGET bluesky bluesky-test
+# APPEND PROPERTY LINK_FLAGS ${GLIB_LDLAGS})
+
+set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
+set(INSTALL_RPATH_USE_LINK_PATH 1)
+include_directories(${GLIB_INCLUDE_DIRS} ".")
+target_link_libraries(bluesky ${GLIB_LIBRARIES} s3)
+target_link_libraries(bluesky-test bluesky ${GLIB_LIBRARIES})
+target_link_libraries(nfsproxy bluesky ${GLIB_LIBRARIES})
+
+#message("GLIB CFLAGS:" ${GLIB_CFLAGS})
+#message("GLIB CFLAGS:" (get_property TARGET bluesky PROPERTY COMPILE_FLAGS))
+++ /dev/null
-LIBS3_PATH=$(HOME)/scratch/libs3-1.4/build
-PACKAGES=glib-2.0 gthread-2.0
-DEBUG=-g
-CFLAGS=-O -std=gnu99 -Wall -D_FILE_OFFSET_BITS=64 $(DEBUG) \
- $(shell pkg-config --cflags $(PACKAGES))
-CXXFLAGS=-O -Wall -D_FILE_OFFSET_BITS=64 $(DEBUG) \
- $(shell pkg-config --cflags $(PACKAGES))
-LDFLAGS=$(DEBUG) $(shell pkg-config --libs $(PACKAGES))
-SUBDIRS=nfs3
-
-SRCS=dir.c inode.c store.c
-OBJS=$(SRCS:.c=.o) s3store.o
-
-all : bluesky
- for d in $(SUBDIRS); do $(MAKE) -C $$d; done
-
-bluesky.a : $(OBJS)
- $(AR) -r $@ $(OBJS)
- ranlib $@
-
-bluesky : main.o bluesky.a
- $(CXX) $(LDFLAGS) -o $@ $^ -Wl,-rpath=$(LIBS3_PATH)/lib -L$(LIBS3_PATH)/lib -ls3
-
-clean :
- rm -f $(OBJS) bluesky
- for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
-
-dep :
- touch Makefile.dep
- makedepend -fMakefile.dep $(SRCS)
-
-.PHONY : all clean dep
-
--include *.dep