diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3e0c6b28..0ce3580a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -19,12 +19,20 @@ if(USE_OPENMP)
message(STATUS "OpenMP libomp location: ${OpenMP_libomp_LIBRARY} | Include: ${OpenMP_CXX_INCLUDE_DIRS}")
message(STATUS "OpenMP Flags: C -> ${OpenMP_C_FLAGS} | CXX -> ${OpenMP_CXX_FLAGS}")
set(SRW_DEFINITIONS -D_GNU_SOURCE -D__USE_XOPEN2K8 -DFFTW_ENABLE_FLOAT -D_GM_WITHOUT_BASE -DSRWLIB_STATIC -DNO_TIMER -DANSI_DECLARATORS -DTRILIBRARY -D_WITH_OMP)
+
+ # Setup OpenMP as a linked library for all targets
+ link_libraries(OpenMP::OpenMP_CXX)
+ # Setup OpenMP include dir for all targets
+ include_directories(${OpenMP_CXX_INCLUDE_DIRS})
else()
set(SRW_DEFINITIONS -D_GNU_SOURCE -D__USE_XOPEN2K8 -DFFTW_ENABLE_FLOAT -D_GM_WITHOUT_BASE -DSRWLIB_STATIC -DNO_TIMER -DANSI_DECLARATORS -DTRILIBRARY -D_FFTW3)
endif()
+# Setup definitions for all targets
+add_definitions(${SRW_DEFINITIONS})
+
add_subdirectory(ext)
add_subdirectory(core)
add_subdirectory(lib)
-add_subdirectory(clients)
\ No newline at end of file
+add_subdirectory(clients)
diff --git a/src/clients/python/CMakeLists.txt b/src/clients/python/CMakeLists.txt
index 11fbacda..b81b7f5d 100644
--- a/src/clients/python/CMakeLists.txt
+++ b/src/clients/python/CMakeLists.txt
@@ -40,4 +40,4 @@ if(WIN32)
endif()
-install(TARGETS srwlpy LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
\ No newline at end of file
+install(TARGETS srwlpy LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 2c17a1c6..6baa0792 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -25,11 +25,6 @@ if (UNIX)
target_link_libraries(srw m)
endif()
-if (USE_OPENMP)
- target_link_libraries(srw OpenMP::OpenMP_CXX)
- target_include_directories(srw PUBLIC ${OpenMP_CXX_INCLUDE_DIRS})
-endif()
-
target_include_directories(srw PUBLIC
$
)
@@ -46,4 +41,4 @@ target_include_directories(srw PUBLIC
$
)
-install(TARGETS srw LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
\ No newline at end of file
+install(TARGETS srw LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})