cmake_minimum_required(VERSION 3.5.0)
cmake_policy(SET CMP0048 NEW)
+# Specify search path for CMake modules to be loaded by include()
+# and find_package()
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
+
+# Add defaults for cmake
+# Those need to be set before the project() call.
+include(DefineCMakeDefaults)
+include(DefineCompilerFlags)
+
project(resolv_wrapper VERSION 1.1.5 LANGUAGES C)
# global needed variables
)
# add definitions
-include(DefineCMakeDefaults)
include(DefinePlatformDefaults)
include(DefineInstallationPaths)
include(DefineOptions.cmake)
enable_testing()
include(CTest)
-if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
- set(CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags")
- set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
- set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
- set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
-endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
-
function (ADD_CMOCKA_TEST _testName _testSource)
add_executable(${_testName} ${_testSource})
target_link_libraries(${_testName} ${ARGN})
--- /dev/null
+if (UNIX AND NOT WIN32)
+ # Activate with: -DCMAKE_BUILD_TYPE=Profiling
+ set(CMAKE_C_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the C compiler during PROFILING builds.")
+ set(CMAKE_CXX_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the CXX compiler during PROFILING builds.")
+ set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
+ set(CMAKE_MODULE_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
+ set(CMAKE_EXEC_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the linker during PROFILING builds.")
+endif()