diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2607e56..b88f0f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,9 +73,9 @@ check_include_file( "unistd.h"        HAVE_UNISTD_H   )
 check_include_file( "sgidefs.h"       HAVE_SGIDEFS_H  )
 check_include_file( "stdafx.h"        HAVE_STDAFX_H   )
 check_include_file( "Windows.h"       HAVE_WINDOWS_H  )
-check_include_file( "elf.h"           HAVE_ELF_H      ) 
-check_include_file( "libelf.h"        HAVE_LIBELF_H   ) 
-check_include_file( "libelf/libelf.h" HAVE_LIBELF_LIBELF_H) 
+set(HAVE_ELF_H FALSE)
+set(HAVE_LIBELF_H TRUE)
+set(HAVE_LIBELF_LIBELF_H FALSE)
 check_include_file( "alloca.h"        HAVE_ALLOCA_H   )
 check_include_file( "elfaccess.h"     HAVE_ELFACCESS_H)
 check_include_file( "sys/elf_386.h"   HAVE_SYS_ELF_386_H  )
@@ -146,12 +146,14 @@ elseif(HAVE_LIBELF_LIBELF_H)
 endif()
 
 if (HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H)
-  set (CMAKE_REQUIRED_LIBRARIES elf)
+  set (CMAKE_REQUIRED_LIBRARIES CONAN_PKG::libelf)
+  set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1)
   message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getehdr")
   check_symbol_exists( elf64_getehdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETEHDR)
   message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getshdr")
   check_symbol_exists( elf64_getshdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETSHDR)
   set (CMAKE_REQUIRED_LIBRARIES)
+  set (CMAKE_REQUIRED_DEFINITIONS)
 endif()
 
 option(DWARF_WITH_LIBELF "Use libelf (default is YES)" TRUE)
@@ -166,6 +168,10 @@ if (DWARF_WITH_LIBELF)
   message(STATUS "checking using HAVE_ELF_H ... ${HAVE_ELF_H}")
   message(STATUS "checking using elf header ... ${HAVE_LOCATION_OF_LIBELFHEADER}")
   message(STATUS "checking using libelf header ... ${JUST_LIBELF}")
+
+  set (CMAKE_REQUIRED_LIBRARIES CONAN_PKG::libelf)
+  set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1)
+
   check_c_source_compiles("
   #include ${HAVE_LOCATION_OF_LIBELFHEADER}
   int main()      
@@ -202,7 +208,7 @@ if (DWARF_WITH_LIBELF)
   # to set HAVE_LIBELF_OFF64_OK at present. 
   check_c_source_compiles("
   #define _GNU_SOURCE 1
-  #include ${JUST_LIBELF}
+  #include <${JUST_LIBELF}>
   int main()
   { 
       off64_t  p; p = 0;
@@ -210,7 +216,7 @@ if (DWARF_WITH_LIBELF)
   }"  HAVE_LIBELF_OFF64_OK)
 
   check_c_source_compiles("
-  #include ${JUST_LIBELF}
+  #include <${JUST_LIBELF}>
   /* This must be at global scope */
   struct _Elf;
   typedef struct _Elf Elf;
@@ -220,6 +226,10 @@ if (DWARF_WITH_LIBELF)
    int i = 12;
    return 0;
   }" HAVE_STRUCT_UNDERSCORE_ELF)
+
+  set (CMAKE_REQUIRED_LIBRARIES)
+  set (CMAKE_REQUIRED_DEFINITIONS)
+
 endif()
 message(STATUS "Assuming struct Elf for the default libdwarf.h")
 # Because cmake treats ; in an interesting way attempting
@@ -381,7 +391,7 @@ message(STATUS "Checking producer generates only 32bit... ${HAVE_STRICT_DWARF2_3
 find_package(LibElf REQUIRED)
 list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBELF_INCLUDE_DIRS})
 
-configure_file(config.h.in.cmake config.h)
+configure_file(${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake ${CMAKE_BINARY_DIR}/config.h)
 
 if(BUILD_NON_SHARED)
 	set(DWARF_TARGETS dwarf-static)
@@ -395,7 +405,6 @@ if(BUILD_SHARED)
 endif()
 
 add_subdirectory(libdwarf)
-add_subdirectory(dwarfdump)
 if ( BUILD_DWARFGEN )
 	if ( DWARF_WITH_LIBELF )
 	    add_subdirectory(dwarfgen)
diff --git a/dwarfdump/CMakeLists.txt b/dwarfdump/CMakeLists.txt
index b94f6c8..e688ea0 100644
--- a/dwarfdump/CMakeLists.txt
+++ b/dwarfdump/CMakeLists.txt
@@ -28,7 +28,7 @@ set_source_group(HEADERS "Header Files"
   print_reloc.h print_reloc_decls.h section_bitmaps.h uri.h)
 
 set_source_group(CONFIGURATION_FILES "Configuration Files"
-  ${CMAKE_SOURCE_DIR}/config.h.in.cmake
+  ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake
   ${CMAKE_BINARY_DIR}/config.h)
 	
 add_executable(dwarfdump ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES})
@@ -180,10 +180,10 @@ set(LIBDIR lib${SUFFIX})
 set(BINDIR bin${SUFFIX})
 
 install(TARGETS dwarfdump DESTINATION
-	RUNTIME DESTINATION ${BINDIR}		
-	LIBRARY DESTINATION ${LIBDIR}
-	ARCHIVE DESTINATION ${LIBDIR})
+	RUNTIME DESTINATION bin
+  LIBRARY DESTINATION lib
+	ARCHIVE DESTINATION lib)
 
-install(FILES dwarfdump.conf DESTINATION ${LIBDIR})
+install(FILES dwarfdump.conf DESTINATION res)
 
 install(FILES dwarfdump.1 DESTINATION share/man/man1)
diff --git a/dwarfexample/CMakeLists.txt b/dwarfexample/CMakeLists.txt
index 8104691..7c6cd7e 100644
--- a/dwarfexample/CMakeLists.txt
+++ b/dwarfexample/CMakeLists.txt
@@ -1,7 +1,7 @@
 set_source_group(SIMPLE_READER_SOURCES "Source Files" simplereader.c)
 
 set_source_group(CONFIGURATION_FILES "Configuration Files"
-  ${CMAKE_SOURCE_DIR}/config.h.in.cmake
+  ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake
   ${CMAKE_BINARY_DIR}/config.h)
 
 add_executable(simplereader 
diff --git a/dwarfgen/CMakeLists.txt b/dwarfgen/CMakeLists.txt
index 488b820..bcc92b4 100644
--- a/dwarfgen/CMakeLists.txt
+++ b/dwarfgen/CMakeLists.txt
@@ -11,7 +11,7 @@ set_source_group(HEADERS "Header Files" createirepfrombinary.h
     strtabdata.h ../libdwarf/dwgetopt.h)
 
 set_source_group(CONFIGURATION_FILES "Configuration Files" 
-    ${CMAKE_SOURCE_DIR}/config.h.in.cmake
+    ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake
     ${CMAKE_BINARY_DIR}/config.h)
     
 add_executable(dwarfgen ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES})
@@ -27,9 +27,9 @@ set(LIBDIR lib${SUFFIX})
 set(BINDIR bin${SUFFIX})
 
 install(TARGETS dwarfgen DESTINATION
-	RUNTIME DESTINATION ${BINDIR}		
-	LIBRARY DESTINATION ${LIBDIR}
-	ARCHIVE DESTINATION ${LIBDIR})
+	RUNTIME DESTINATION bin
+	LIBRARY DESTINATION lib
+	ARCHIVE DESTINATION lib)
 
 #install(FILES dwarfgen.conf DESTINATION lib)
 
diff --git a/libdwarf/CMakeLists.txt b/libdwarf/CMakeLists.txt
index c610522..c0872c0 100644
--- a/libdwarf/CMakeLists.txt
+++ b/libdwarf/CMakeLists.txt
@@ -67,7 +67,7 @@ pro_reloc.h pro_reloc_stream.h pro_reloc_symbolic.h
 pro_section.h pro_types.h pro_util.h)
 
 set_source_group(CONFIGURATION_FILES "Configuration Files" 
-    ${CMAKE_SOURCE_DIR}/config.h.in.cmake 
+    ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake 
     ${CMAKE_BINARY_DIR}/config.h)
 
 
@@ -81,12 +81,9 @@ foreach(i RANGE ${targetCount})
             ${GENNAMES_OUTPUT} ${CONFIGURATION_FILES})
 
 	set_folder(${target} libdwarf)
-	target_include_directories(${target} PUBLIC 
-            ${LIBELF_INCLUDE_DIRS})
-        target_compile_options(${target} PRIVATE ${DW_FWALL})
 	msvc_posix(${target})
 
-	target_link_libraries(${target} PUBLIC ${LIBELF_LIBRARIES})
+  conan_target_link_libraries(${target})
 	
 	set_target_properties(${target} PROPERTIES OUTPUT_NAME dwarf)
 
@@ -95,15 +92,14 @@ foreach(i RANGE ${targetCount})
 	set(BINDIR bin${SUFFIX})
 
 	install(TARGETS ${target}
-		RUNTIME DESTINATION ${BINDIR}		
-		LIBRARY DESTINATION ${LIBDIR}
-		ARCHIVE DESTINATION ${LIBDIR})
+		RUNTIME DESTINATION bin
+    LIBRARY DESTINATION lib
+		ARCHIVE DESTINATION lib)
 endforeach()
 
-if(UNIX AND BUILD_SHARED)
-	target_link_libraries(dwarf-shared PUBLIC z)
-endif()
-		
+install(FILES ${CMAKE_BINARY_DIR}/source_subfolder/libdwarf/libdwarf.h DESTINATION include)
+install(FILES dwarf.h DESTINATION include)
+
 if (DO_TESTING)
     set_source_group(TESTLEB "Source Files" dwarf_leb_test.c 
         dwarf_leb.c pro_encode_nm.c )
