diff --git a/CMakeLists.txt b/CMakeLists.txt index d8a25bf..2d62222 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ enable_testing() ### Project options ### ## Project stuff -option(YAML_CPP_BUILD_TOOLS "Enable testing and parse tools" ON) +option(YAML_CPP_BUILD_TOOLS "Enable testing and parse tools" ON) option(YAML_CPP_BUILD_CONTRIB "Enable contrib stuff in library" ON) ## Build options @@ -118,33 +118,33 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif() ### Project stuff - if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) - endif() - # - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") - set(CMAKE_CXX_FLAGS_DEBUG "-g") - set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os") + if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) + endif() + # + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_DEBUG "-g") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os") + # + set(GCC_EXTRA_OPTIONS "") # - set(GCC_EXTRA_OPTIONS "") - # set(FLAG_TESTED "-Wextra") check_cxx_compiler_flag(${FLAG_TESTED} FLAG_WEXTRA) if(FLAG_WEXTRA) set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} ${FLAG_TESTED}") endif() # - set(CMAKE_CXX_FLAGS "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long ${CMAKE_CXX_FLAGS}") # - add_custom_target(debuggable $(MAKE) clean - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} - COMMENT "Adjusting settings for debug compilation" - VERBATIM) - add_custom_target(releasable $(MAKE) clean - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} - COMMENT "Adjusting settings for release compilation" - VERBATIM) + add_custom_target(debuggable $(MAKE) clean + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMENT "Adjusting settings for debug compilation" + VERBATIM) + add_custom_target(releasable $(MAKE) clean + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + COMMENT "Adjusting settings for release compilation" + VERBATIM) endif() # Microsoft VisualC++ specialities diff --git a/include/yaml-cpp/dll.h b/include/yaml-cpp/dll.h index 3c82c1a..c09cf6b 100644 --- a/include/yaml-cpp/dll.h +++ b/include/yaml-cpp/dll.h @@ -1,28 +1,28 @@ -#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the yaml_cpp_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// YAML_CPP_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. -#undef YAML_CPP_API - -#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined manually) - #ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake or defined manually) - // #pragma message( "Defining YAML_CPP_API for DLL export" ) - #define YAML_CPP_API __declspec(dllexport) - #else // yaml_cpp_EXPORTS - // #pragma message( "Defining YAML_CPP_API for DLL import" ) - #define YAML_CPP_API __declspec(dllimport) - #endif // yaml_cpp_EXPORTS -#else //YAML_CPP_DLL -#define YAML_CPP_API -#endif // YAML_CPP_DLL - -#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the yaml_cpp_EXPORTS +// symbol defined on the command line. this symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// YAML_CPP_API functions as being imported from a DLL, whereas this DLL sees symbols +// defined with this macro as being exported. +#undef YAML_CPP_API + +#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined manually) + #ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake or defined manually) + // #pragma message( "Defining YAML_CPP_API for DLL export" ) + #define YAML_CPP_API __declspec(dllexport) + #else // yaml_cpp_EXPORTS + // #pragma message( "Defining YAML_CPP_API for DLL import" ) + #define YAML_CPP_API __declspec(dllimport) + #endif // yaml_cpp_EXPORTS +#else //YAML_CPP_DLL +#define YAML_CPP_API +#endif // YAML_CPP_DLL + +#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66