Skip to content

Commit

Permalink
More cmake modernization updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed Dec 13, 2020
1 parent 12f191a commit d7ffe27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
6 changes: 2 additions & 4 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ endif()
# Make sure expat is compiled as a static library
target_compile_definitions(project_options INTERFACE "-DXML_STATIC")

set(CMAKE_CXX_STANDARD 17)

This comment has been minimized.

Copy link
@nealkruis

nealkruis Sep 21, 2021

Member

@lefticus I know this is really old now, but I can't figure out why this was removed and how the C++17 standard is now being set for the builds.


if(APPLE)
# Force no auto ptr
# TODO remove this after kiva/boost is updated to a version that supports
Expand Down Expand Up @@ -81,8 +79,8 @@ elseif(
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++
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
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
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")
Expand Down
24 changes: 7 additions & 17 deletions cmake/ProjectMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ endmacro()
macro(CREATE_TEST_TARGETS BASE_NAME SRC DEPENDENCIES)
if(BUILD_TESTING)

if(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# Disabled Warnings:
# 1684 conversion from pointer to same-sized integral type (potential portability problem) - Due to gtest...
add_cxx_definitions("-diag-disable:1684")
endif()

add_executable(${BASE_NAME}_tests ${SRC})
target_link_libraries(${BASE_NAME}_tests PRIVATE project_options)
if(ENABLE_GTEST_DEBUG_MODE)
target_compile_definitions(${BASE_NAME}_tests PRIVATE ENABLE_GTEST_DEBUG_MODE)
endif()

if(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# Disabled Warnings:
# 1684 conversion from pointer to same-sized integral type (potential portability problem) - Due to gtest...
target_compile_options(${BASE_NAME}_tests PRIVATE -diag-disable:1684)
endif()


create_src_groups("${SRC}")

get_target_property(BASE_NAME_TYPE ${BASE_NAME} TYPE)
Expand Down Expand Up @@ -168,17 +169,6 @@ function(ADD_SIMULATION_TEST)

endfunction()

macro(ADD_CXX_DEFINITIONS NEWFLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NEWFLAGS}")
endmacro()

macro(ADD_CXX_DEBUG_DEFINITIONS NEWFLAGS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${NEWFLAGS}")
endmacro()

macro(ADD_CXX_RELEASE_DEFINITIONS NEWFLAGS)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${NEWFLAGS}")
endmacro()

function(fixup_executable EXECUTABLE_PATH)
include(GetPrerequisites)
Expand Down
4 changes: 3 additions & 1 deletion src/EnergyPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,9 @@ 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 project_warnings)
target_link_libraries(TestAPI_Runtime_C PRIVATE energyplusapi project_options )
target_compile_options(TestAPI_Runtime_C PRIVATE -Wall -Wextra -Wno-unused)

add_test(NAME "API.TestRuntimeC" COMMAND TestAPI_Runtime_C -d "${TEST_DIR}"
-w "${EPW_FILE}" -D "${IDF_FILE}")

Expand Down

0 comments on commit d7ffe27

Please sign in to comment.