diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 59df411829bc7c2bf32c4bdadf2926a4b81fa6d7..6b9783e3d9e9ec70cd623d1a5a7f4dca055937b1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -15,8 +15,7 @@ add_library(aec_static STATIC "$<TARGET_OBJECTS:aec>")
 target_link_libraries(aec_static PUBLIC aec)
 set_target_properties(aec_static
   PROPERTIES
-  OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,aec-static,aec>
-)
+  OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,aec-static,aec>)
 
 add_library(aec_shared SHARED "$<TARGET_OBJECTS:aec>")
 target_link_libraries(aec_shared PUBLIC aec)
@@ -24,7 +23,8 @@ set_target_properties(aec_shared
   PROPERTIES
   VERSION 0.0.12
   SOVERSION 0
-  OUTPUT_NAME aec)
+  OUTPUT_NAME aec
+  PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/../include/libaec.h)
 
 # Wrapper for compatibility with szip
 add_library(sz OBJECT sz_compat.c)
@@ -43,7 +43,8 @@ set_target_properties(sz_shared
   PROPERTIES
   VERSION 2.0.1
   SOVERSION 2
-  OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip,sz>)
+  OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip,sz>
+  PUBLIC_HEADER ../include/szlib.h)
 
 # Simple client for testing and benchmarking.
 # Can also be used stand-alone
diff --git a/src/Makefile.am b/src/Makefile.am
index e263a22416f5e487e570687651e3e440132a6311..823dfd2f9689e52edb5adfce927d2a4c1b9e2511 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = $(CFLAG_VISIBILITY)
-AM_CPPFLAGS = -I$(top_srcdir)/include -DBUILDING_LIBAEC
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include \
+-DBUILDING_LIBAEC
 lib_LTLIBRARIES = libaec.la libsz.la
 libaec_la_SOURCES = encode.c encode_accessors.c decode.c \
 encode.h encode_accessors.h decode.h
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 50b2036828345c077e7a778ccea35d736d40d5eb..d66304e93d2a8bc73889b922d4587f6f446c8d2a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,5 @@
 AUTOMAKE_OPTIONS = color-tests
-AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 TESTS = check_code_options check_buffer_sizes check_long_fs \
 szcomp.sh sampledata.sh
 TEST_EXTENSIONS = .sh