From e471c2357d26ce212562763520f0a6139e8af372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 13 Jan 2019 11:40:09 +0100 Subject: [PATCH] cmake: set _GNU_SOURCE globally, and only once --- CMakeLists.txt | 13 +++++-------- modules/CMakeLists.txt | 1 - particles/CMakeLists.txt | 1 - 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bf63d9..e18de16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ set(CMAKE_C_STANDARD 11) set_property(DIRECTORY . APPEND PROPERTY COMPILE_DEFINITIONS $<$:_DEBUG> + _GNU_SOURCE ) set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") @@ -14,11 +15,10 @@ set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") find_package(Threads REQUIRED) find_package(PkgConfig REQUIRED) -pkg_check_modules(XCB REQUIRED xcb xcb-randr xcb-render xcb-cursor) # Core -pkg_check_modules(FONTCONFIG REQUIRED fontconfig) # Core -pkg_check_modules(CAIRO REQUIRED cairo cairo-xcb cairo-ft) # Core -pkg_check_modules(YAML REQUIRED yaml-0.1) # Core (configuration) - +pkg_check_modules(XCB REQUIRED xcb xcb-randr xcb-render xcb-cursor) +pkg_check_modules(FONTCONFIG REQUIRED fontconfig) +pkg_check_modules(CAIRO REQUIRED cairo cairo-xcb cairo-ft) +pkg_check_modules(YAML REQUIRED yaml-0.1) add_executable(f00bar bar.c bar.h @@ -42,9 +42,6 @@ add_executable(f00bar particles/dynlist.c particles/dynlist.h ) -# TODO: directory global -target_compile_definitions(f00bar PRIVATE _GNU_SOURCE) - # Make global symbols in f00bar visible to dlopen:ed plugins set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic") diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 189459e..2e4209f 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.13) add_library(module-sdk INTERFACE) -target_compile_definitions(module-sdk INTERFACE _GNU_SOURCE) target_compile_options(module-sdk INTERFACE ${CAIRO_CFLAGS_OTHER}) target_include_directories(module-sdk INTERFACE ${CAIRO_INCLUDE_DIRS}) target_link_libraries(module-sdk INTERFACE ${CMAKE_THREAD_LIBS_INIT}) diff --git a/particles/CMakeLists.txt b/particles/CMakeLists.txt index 1c41e95..c66fc55 100644 --- a/particles/CMakeLists.txt +++ b/particles/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.13) add_library(particle-sdk INTERFACE) -target_compile_definitions(particle-sdk INTERFACE _GNU_SOURCE) target_compile_options(particle-sdk INTERFACE ${CAIRO_CFLAGS_OTHER}) target_include_directories(particle-sdk INTERFACE ${CAIRO_INCLUDE_DIRS})