diff --git a/CMakeLists.txt b/CMakeLists.txt index d19fe788864..d507d9bf5a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) add_library(project_options INTERFACE) target_compile_features(project_options INTERFACE cxx_std_17) +add_library(project_warnings INTERFACE) + set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) target_link_libraries(project_options INTERFACE Threads::Threads) diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake index 6443c1638ec..3a16ca87db8 100644 --- a/cmake/CompilerFlags.cmake +++ b/cmake/CompilerFlags.cmake @@ -1,13 +1,13 @@ # Compiler-agnostic compiler flags first -add_cxx_definitions("-DOBJEXXFCL_ALIGN=64") # Align ObjexxFCL arrays to 64B -add_cxx_debug_definitions("-DOBJEXXFCL_ARRAY_INIT_DEBUG") # Initialize ObjexxFCL arrays to aid debugging +target_compile_definitions(project_options INTERFACE "-DOBJEXXFCL_ALIGN=64") # Align ObjexxFCL arrays to 64B +target_compile_options(project_options INTERFACE $<$:"-DOBJEXXFCL_ARRAY_INIT_DEBUG">) # Initialize ObjexxFCL arrays to aid debugging if(NOT OPENGL_FOUND) - add_definitions("-DEP_NO_OPENGL") + target_compile_definitions(project_options INTERFACE "-DEP_NO_OPENGL") endif() # Make sure expat is compiled as a static library -add_definitions("-DXML_STATIC") +target_compile_definitions(project_options INTERFACE "-DXML_STATIC") set(CMAKE_CXX_STANDARD 17) @@ -15,17 +15,17 @@ if(APPLE) # Force no auto ptr # TODO remove this after kiva/boost is updated to a version that supports # C++17 - add_definitions("-DBOOST_NO_AUTO_PTR") + target_compile_definitions(project_options INTERFACE "-DBOOST_NO_AUTO_PTR") endif() if(MSVC AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) # Visual C++ (VS 2013) # COMPILER FLAGS - add_compile_options("/nologo") - add_compile_options("/EHsc") - add_compile_options("/MP") # Enables multi-processor compilation of source within a single project - string(REGEX REPLACE "/W3" "/W1" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" - )# Increase to /W2 then /W3 as more serious warnings are addressed (using regex to avoid VC override warnings) + target_compile_options(project_options INTERFACE "/nologo") + target_compile_options(project_options INTERFACE "/EHsc") + target_compile_options(project_options INTERFACE "/MP") # Enables multi-processor compilation of source within a single project + # string(REGEX REPLACE "/W3" "/W1" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" + # )# Increase to /W2 then /W3 as more serious warnings are addressed (using regex to avoid VC override warnings) # Disabled Warnings: Enable some of these as more serious warnings are addressed # 4068 Unknown pragma @@ -36,7 +36,7 @@ if(MSVC AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) # Visual C++ (VS # 4355 Passing this pointer in class initializer (object is incomplete so bases/members can only use this in limited ways) # 4996 Deprecated functions (/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS) # 4503 The decorated name was longer than the compiler limit (4096), and was truncated. - add_compile_options( + target_compile_options(project_warnings INTERFACE /wd4068 /wd4101 /wd4102 @@ -46,18 +46,18 @@ if(MSVC AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) # Visual C++ (VS /wd4996 /wd4503) # Disables warning messages listed above - add_definitions(/DNOMINMAX) # Avoid build errors due to STL/Windows min-max conflicts - add_definitions(/DWIN32_LEAN_AND_MEAN) # Excludes rarely used services and headers from compilation + target_compile_definitions(project_options INTERFACE /DNOMINMAX) # Avoid build errors due to STL/Windows min-max conflicts + target_compile_definitions(project_options INTERFACE /DWIN32_LEAN_AND_MEAN) # Excludes rarely used services and headers from compilation # ADD_CXX_DEFINITIONS("-d2SSAOptimizer-") # this disables this optimizer which has known major issues # ADDITIONAL RELEASE-MODE-SPECIFIC FLAGS - add_cxx_release_definitions("/GS-") # Disable buffer overrun checks for performance in release mode + target_compile_options(project_options INTERFACE $<$:"/GS-">) # Disable buffer overrun checks for performance in release mode # ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS - add_cxx_debug_definitions("/Ob0") # Disable inlining - add_cxx_debug_definitions("/RTCsu") # Runtime checks - add_cxx_debug_definitions("/fp:strict") # Floating point model - add_cxx_debug_definitions("/DMSVC_DEBUG") # Triggers code in main.cc to catch floating point NaNs + target_compile_options(project_options INTERFACE $<$:"/Ob0">) # Disable inlining + target_compile_options(project_options INTERFACE $<$:"/RTCsu">) # Runtime checks + target_compile_options(project_options INTERFACE $<$:"/fp:strict">) # Floating point model + target_compile_options(project_options INTERFACE $<$:"/DMSVC_DEBUG">) # Triggers code in main.cc to catch floating point NaNs elseif( CMAKE_COMPILER_IS_GNUCXX @@ -65,45 +65,41 @@ elseif( OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # g++/Clang option(ENABLE_COVERAGE "Enable Coverage Reporting in GCC" FALSE) if(ENABLE_COVERAGE) - add_definitions("--coverage -O0") - set(LINKER_FLAGS "${LINKER_FLAGS} --coverage") + target_compile_definitions(project_options INTERFACE --coverage -O0 -g) + target_link_libraries(project_options INTERFACE --coverage) endif() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}") - # COMPILER FLAGS - add_cxx_definitions("-pipe") # Faster compiler processing - add_cxx_definitions("-Wpedantic") # Turn on warnings about constructs/situations that may be non-portable or outside of the standard - add_cxx_definitions("-Wall -Wextra") # Turn on warnings - add_cxx_definitions("-Wno-unknown-pragmas") + target_compile_options(project_options INTERFACE "-pipe") # Faster compiler processing + target_compile_options(project_warnings INTERFACE "-Wpedantic") # Turn on warnings about constructs/situations that may be non-portable or outside of the standard + target_compile_options(project_warnings INTERFACE -Wall -Wextra) # Turn on warnings + target_compile_options(project_warnings INTERFACE "-Wno-unknown-pragmas") if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) - add_cxx_definitions("-Wno-deprecated-copy") + target_compile_options(project_warnings INTERFACE "-Wno-deprecated-copy") endif() - add_cxx_definitions("-Wno-attributes") # Don't warn on attributes Clang doesn't know - add_cxx_definitions("-Wno-delete-non-virtual-dtor") - add_cxx_definitions("-Wno-missing-braces") + target_compile_options(project_warnings INTERFACE "-Wno-attributes") # Don't warn on attributes Clang doesn't know + target_compile_options(project_warnings INTERFACE "-Wno-delete-non-virtual-dtor") + target_compile_options(project_warnings INTERFACE "-Wno-missing-braces") if(CMAKE_COMPILER_IS_GNUCXX) # g++ - add_cxx_definitions("-Wno-unused-but-set-parameter -Wno-unused-but-set-variable" + target_compile_options(project_warnings INTERFACE "-Wno-unused-but-set-parameter" "-Wno-unused-but-set-variable" )# Suppress unused-but-set warnings until more serious ones are addressed - add_cxx_definitions("-Wno-maybe-uninitialized") - add_cxx_definitions("-Wno-aggressive-loop-optimizations") + target_compile_options(project_warnings INTERFACE "-Wno-maybe-uninitialized") + target_compile_options(project_warnings INTERFACE "-Wno-aggressive-loop-optimizations") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") - add_cxx_definitions("-Wno-vexing-parse") - add_cxx_definitions("-Wno-invalid-source-encoding") + target_compile_options(project_warnings INTERFACE "-Wno-vexing-parse") + target_compile_options(project_warnings INTERFACE "-Wno-invalid-source-encoding") endif() # ADDITIONAL GCC-SPECIFIC FLAGS if(CMAKE_COMPILER_IS_GNUCXX) # g++ - add_cxx_debug_definitions("-ffloat-store") # Improve debug run solution stability - add_cxx_debug_definitions("-fsignaling-nans") # Disable optimizations that may have concealed NaN behavior - add_cxx_debug_definitions("-D_GLIBCXX_DEBUG") # Standard container debug mode (bounds checking, ...) + target_compile_options(project_options INTERFACE $<$:"-ffloat-store">) # Improve debug run solution stability + target_compile_options(project_options INTERFACE $<$:"-fsignaling-nans">) # Disable optimizations that may have concealed NaN behavior + target_compile_options(project_options INTERFACE $<$:"-D_GLIBCXX_DEBUG">) # Standard container debug mode (bounds checking, ...>) # ADD_CXX_RELEASE_DEFINITIONS("-finline-limit=2000") # More aggressive inlining This is causing unit test failures on Ubuntu 14.04 endif() - add_cxx_debug_definitions("-ggdb") # Produces debugging information specifically for gdb - add_cxx_release_definitions("-fno-stack-protector") + target_compile_options(project_options INTERFACE $<$:"-ggdb">) # Produces debugging information specifically for gdb + target_compile_options(project_options INTERFACE $<$:-fno-stack-protector>) # ADD_CXX_RELEASE_DEFINITIONS("-Ofast") # -Ofast (or -ffast-math) needed to auto-vectorize floating point loops elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") @@ -122,12 +118,12 @@ elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # 11075 Inlining inhibited # COMPILER FLAGS - add_cxx_definitions("/nologo") # Skip banner text - add_cxx_definitions("/Qcxx-features") # Enables standard C++ features without disabling Microsoft extensions - add_cxx_definitions("/Wall") # Enable "all" warnings - add_cxx_definitions("/Qdiag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075") # Disable warnings listed above - add_cxx_definitions("/DNOMINMAX") # Avoid build errors due to STL/Windows min-max conflicts - add_cxx_definitions("/DWIN32_LEAN_AND_MEAN") # Excludes rarely used services and headers from compilation + target_compile_options(project_options INTERFACE "/nologo") # Skip banner text + target_compile_options(project_options INTERFACE "/Qcxx-features") # Enables standard C++ features without disabling Microsoft extensions + target_compile_options(project_options INTERFACE "/Wall") # Enable "all" warnings + target_compile_options(project_options INTERFACE "/Qdiag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075") # Disable warnings listed above + target_compile_definitions(project_options INTERFACE "/DNOMINMAX") # Avoid build errors due to STL/Windows min-max conflicts + target_compile_definitions(project_options INTERFACE "/DWIN32_LEAN_AND_MEAN") # Excludes rarely used services and headers from compilation # Optimization options that had no significant benefit for EnergyPlus # /Qipo instead of /Qip @@ -136,23 +132,21 @@ elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # /Qunroll-aggressive # ADDITIONAL RELEASE-MODE-SPECIFIC FLAGS - add_cxx_release_definitions("/O3") # Agressive optimization - add_cxx_release_definitions("/Qprec-div-") # Faster division - add_cxx_release_definitions("/Qansi-alias") # Better optimization via strict aliasing rules - add_cxx_release_definitions("/Qip") # Inter-procedural optimnization within a single file - add_cxx_release_definitions("/Qinline-factor:225") # Aggressive inlining + target_compile_options(project_options INTERFACE $<$:"/O3">) # Agressive optimization + target_compile_options(project_options INTERFACE $<$:"/Qprec-div-">) # Faster division + target_compile_options(project_options INTERFACE $<$:"/Qansi-alias">) # Better optimization via strict aliasing rules + target_compile_options(project_options INTERFACE $<$:"/Qip">) # Inter-procedural optimnization within a single file + target_compile_options(project_options INTERFACE $<$:"/Qinline-factor:225">) # Aggressive inlining # ADD_CXX_RELEASE_DEFINITIONS("/fp:fast=2") # Aggressive optimizations on floating-point data # ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS - add_cxx_debug_definitions("/fp:source") # Use source-specified floating point precision - add_cxx_debug_definitions("/Qtrapuv") # Initialize local variables to unusual values to help detect use uninitialized - add_cxx_debug_definitions("/check:stack,uninit" - )# Enables runtime checking of the stack (buffer over and underruns; pointer verification) and uninitialized variables - add_cxx_debug_definitions("/Gs0") # Enable stack checking for all functions - add_cxx_debug_definitions("/GS") # Buffer overrun detection - add_cxx_debug_definitions("/Qfp-stack-check" - )# Tells the compiler to generate extra code after every function call to ensure fp stack is as expected - add_cxx_debug_definitions("/traceback") # Enables traceback on error + target_compile_options(project_options INTERFACE $<$:"/fp:source">) # Use source-specified floating point precision + target_compile_options(project_options INTERFACE $<$:"/Qtrapuv">) # Initialize local variables to unusual values to help detect use uninitialized + target_compile_options(project_options INTERFACE $<$:"/check:stack,uninit")# Enables runtime checking of the stack (buffer over and underruns; pointer verification>) and uninitialized variables + target_compile_options(project_options INTERFACE $<$:"/Gs0">) # Enable stack checking for all functions + target_compile_options(project_options INTERFACE $<$:"/GS">) # Buffer overrun detection + target_compile_options(project_options INTERFACE $<$:"/Qfp-stack-check">)# Tells the compiler to generate extra code after every function call to ensure fp stack is as expected + target_compile_options(project_options INTERFACE $<$:"/traceback">) # Enables traceback on error elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") @@ -170,12 +164,8 @@ elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # 11075 Inlining inhibited # COMPILER FLAGS - add_cxx_definitions("-Wall") # Enable "all" warnings - add_cxx_definitions("-diag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075") # Disable warnings listed above - - if(NOT APPLE) - add_cxx_definitions(-pthread) - endif() + target_compile_options(project_warnings INTERFACE "-Wall") # Enable "all" warnings + target_compile_options(project_warnings INTERFACE "-diag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075") # Disable warnings listed above # Optimization options that had no significant benefit for EnergyPlus # -ipo instead of -ip @@ -184,22 +174,21 @@ elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # -unroll-aggressive # ADDITIONAL RELEASE-MODE-SPECIFIC FLAGS - add_cxx_release_definitions("-O3") # Agressive optimization + target_compile_options(project_options INTERFACE $<$:"-O3">) # Agressive optimization # ADD_CXX_RELEASE_DEFINITIONS("-Ofast") # More aggressive optimizations (instead of -O3) (enables -no-prec-div and -fp-model fast=2) - add_cxx_release_definitions("-no-prec-div") # Faster division (enabled by -Ofast) - add_cxx_release_definitions("-ansi-alias") # Enables more aggressive optimizations on floating-point data - add_cxx_release_definitions("-ip") # Enables inter-procedural optimnization within a single file - add_cxx_release_definitions("-inline-factor=225") # Enables more aggressive inlining + target_compile_options(project_options INTERFACE $<$:"-no-prec-div") # Faster division (enabled by -Ofast>) + target_compile_options(project_options INTERFACE $<$:"-ansi-alias">) # Enables more aggressive optimizations on floating-point data + target_compile_options(project_options INTERFACE $<$:"-ip">) # Enables inter-procedural optimnization within a single file + target_compile_options(project_options INTERFACE $<$:"-inline-factor=225">) # Enables more aggressive inlining # ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS - add_cxx_debug_definitions("-strict-ansi") # Strict language conformance: Performance impact so limit to debug build - add_cxx_debug_definitions("-fp-model source") # Use source-specified floating point precision - add_cxx_debug_definitions("-ftrapuv") # Initialize local variables to unusual values to help detect use uninitialized - add_cxx_debug_definitions("-check=stack,uninit" - )# Enables runtime checking of the stack (buffer over and underruns; pointer verification) and uninitialized variables - add_cxx_debug_definitions("-fstack-security-check") # Buffer overrun detection - add_cxx_debug_definitions("-fp-stack-check") # Check the floating point stack after every function call - add_cxx_debug_definitions("-traceback") # Enables traceback on error + target_compile_options(project_options INTERFACE $<$:"-strict-ansi">) # Strict language conformance: Performance impact so limit to debug build + target_compile_options(project_options INTERFACE $<$:"-fp-model source">) # Use source-specified floating point precision + target_compile_options(project_options INTERFACE $<$:"-ftrapuv">) # Initialize local variables to unusual values to help detect use uninitialized + target_compile_options(project_options INTERFACE $<$:"-check=stack,uninit")# Enables runtime checking of the stack (buffer over and underruns; pointer verification>) and uninitialized variables + target_compile_options(project_options INTERFACE $<$:"-fstack-security-check">) # Buffer overrun detection + target_compile_options(project_options INTERFACE $<$:"-fp-stack-check">) # Check the floating point stack after every function call + target_compile_options(project_options INTERFACE $<$:"-traceback">) # Enables traceback on error endif() # COMPILER TYPE @@ -208,16 +197,11 @@ endif() # COMPILER TYPE # We use "add_compile_options" instead of just appending to CXX_FLAGS # That way it'll work for pretty much everything including Fortran stuff -macro(AddFlagIfSupported flag test) +macro(add_flag_if_supported flag test) check_cxx_compiler_flag(${flag} ${test}) if(${${test}}) message(STATUS "Adding ${flag}") - # On Mac with Ninja (kitware binary for fortran support) and brew gfortran, I get build errors due to this flag. - if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") AND BUILD_FORTRAN) - add_compile_options($<$>:${flag}>) - else() - add_compile_options("${flag}") - endif() + target_compile_options(project_options INTERFACE "${flag}") else() message(STATUS "Flag ${flag} isn't supported") endif() @@ -227,17 +211,17 @@ if("Ninja" STREQUAL ${CMAKE_GENERATOR}) include(CheckCXXCompilerFlag) # Clang if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") - addflagifsupported(-fcolor-diagnostics COMPILER_SUPPORTS_fdiagnostics_color) + add_flag_if_supported(-fcolor-diagnostics COMPILER_SUPPORTS_fdiagnostics_color) endif() # g++ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - addflagifsupported(-fdiagnostics-color=always COMPILER_SUPPORTS_fdiagnostics_color) + add_flag_if_supported(-fdiagnostics-color=always COMPILER_SUPPORTS_fdiagnostics_color) # On some older gcc, it doesn't say that it's supported, but it works anyways if(NOT COMPILER_SUPPORTS_fdiagnostics_color) message(STATUS "Forcing -fdiagnostics-color=always") - add_compile_options(-fdiagnostics-color=always) + target_compile_options(project_options INTERFACE -fdiagnostics-color=always) endif() endif() diff --git a/src/ConvertInputFormat/CMakeLists.txt b/src/ConvertInputFormat/CMakeLists.txt index 8e7d4ee4645..65a0e38a7d0 100644 --- a/src/ConvertInputFormat/CMakeLists.txt +++ b/src/ConvertInputFormat/CMakeLists.txt @@ -1,22 +1,25 @@ cmake_minimum_required(VERSION 3.5.1) project(ConvertInputFormat) -set(CMAKE_CXX_STANDARD 11) +# set(CMAKE_CXX_STANDARD 11) # Set the CFLAGS and CXXFLAGS depending on the options the user specified. # Only GCC-like compilers support -Wextra, and other compilers give tons of # output for -Wall, so only -Wall and -Wextra on GCC. -if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") -endif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - +#if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") +# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") +#endif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +# if(APPLE OR UNIX) add_executable(ConvertInputFormat main.cpp) else() # windows add_executable(ConvertInputFormat main.cpp) # "${CMAKE_CURRENT_BINARY_DIR}/energyplus.rc" ) endif() + +target_link_libraries(ConvertInputFormat PRIVATE project_options project_warnings) + # Detect OpenMP support in a compiler. If the compiler supports OpenMP, the # flags to compile with OpenMP are returned and added. find_package(OpenMP) diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index 33cafb07d02..7f163f69e9d 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -791,7 +791,7 @@ endif() add_library(energyplusparser STATIC ${INPUTPARSING_SRC}) add_dependencies(energyplusparser GenerateEmbeddedEpJSONSchema) target_link_libraries(energyplusparser PUBLIC re2 fmt::fmt ${CMAKE_DL_LIBS}) -target_link_libraries(energyplusparser PRIVATE project_options) +target_link_libraries(energyplusparser PRIVATE project_options project_warnings) if(WIN32) target_link_libraries(energyplusparser Shlwapi) endif() @@ -815,7 +815,7 @@ target_link_libraries( Windows-CalcEngine airflownetworklib) -target_link_libraries(energypluslib PRIVATE project_options) +target_link_libraries(energypluslib PRIVATE project_options project_warnings) if(OPENGL_FOUND) target_link_libraries(energypluslib PUBLIC penumbra) @@ -874,7 +874,7 @@ else() # windows ${API_CORE_SRC} "${CMAKE_CURRENT_BINARY_DIR}/energyplusapi.rc") endif() target_link_libraries(energyplusapi PUBLIC energypluslib) -target_link_libraries(energyplusapi PRIVATE project_options) +target_link_libraries(energyplusapi PRIVATE project_options project_warnings) set_target_properties(energyplusapi PROPERTIES INSTALL_NAME_DIR "@executable_path") @@ -890,7 +890,7 @@ if(APPLE OR UNIX) else() # windows add_executable(energyplus main.cc "${CMAKE_CURRENT_BINARY_DIR}/energyplus.rc") endif() -target_link_libraries(energyplus PRIVATE energyplusapi project_options) +target_link_libraries(energyplus PRIVATE energyplusapi project_options project_warnings) set_target_properties(energyplus PROPERTIES VERSION ${ENERGYPLUS_VERSION}) set_target_properties(energyplusapi PROPERTIES VERSION ${ENERGYPLUS_VERSION}) @@ -983,7 +983,7 @@ if(BUILD_TESTING) # Build the test executable add_executable(TestEnergyPlusCallbacks test_ep_as_library.cc) target_link_libraries(TestEnergyPlusCallbacks PRIVATE energyplusapi - project_options) + project_options project_warnings) add_test( NAME "API.LegacyCallbackTest" COMMAND @@ -1000,7 +1000,7 @@ if(BUILD_TESTING) add_executable(TestAPI_Functional_C ${PROJECT_SOURCE_DIR}/tst/EnergyPlus/api/TestFunctional.c) target_link_libraries(TestAPI_Functional_C PRIVATE energyplusapi - project_options) + project_options project_warnings) add_test(NAME "API.TestFunctionalC" COMMAND TestAPI_Functional_C) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/tst/api/) @@ -1009,7 +1009,7 @@ if(BUILD_TESTING) file(MAKE_DIRECTORY ${TEST_DIR}) add_executable(TestAPI_Runtime_C ${PROJECT_SOURCE_DIR}/tst/EnergyPlus/api/TestRuntime.c) - target_link_libraries(TestAPI_Runtime_C PRIVATE energyplusapi project_options) + target_link_libraries(TestAPI_Runtime_C PRIVATE energyplusapi project_options project_warnings) add_test(NAME "API.TestRuntimeC" COMMAND TestAPI_Runtime_C -d "${TEST_DIR}" -w "${EPW_FILE}" -D "${IDF_FILE}") @@ -1018,7 +1018,7 @@ if(BUILD_TESTING) add_executable(TestAPI_DataTransfer_C ${PROJECT_SOURCE_DIR}/tst/EnergyPlus/api/TestDataTransfer.c) target_link_libraries(TestAPI_DataTransfer_C PRIVATE energyplusapi - project_options) + project_options project_warnings) add_test(NAME "API.TestDataTransferC" COMMAND TestAPI_DataTransfer_C -d "${TEST_DIR}" -w "${EPW_FILE}" -D "${IDF_FILE}")