Skip to content

Commit

Permalink
modernize cmake for convertinputformat
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed Feb 9, 2021
1 parent 71e6c28 commit 924c138
Showing 1 changed file with 7 additions and 29 deletions.
36 changes: 7 additions & 29 deletions src/ConvertInputFormat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
cmake_minimum_required(VERSION 3.5.1)
project(ConvertInputFormat)

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")

# Detect OpenMP support in a compiler. If the compiler supports OpenMP, the
# flags to compile with OpenMP are returned and added.
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif (OPENMP_FOUND)

if (UNIX)
ADD_DEFINITIONS("-fPIC")
endif()

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 energyplusparser )
# Detect OpenMP support in a compiler. If the compiler supports OpenMP, the
# flags to compile with OpenMP are returned and added.
find_package(OpenMP)
if (OPENMP_FOUND)
target_link_libraries (ConvertInputFormat PRIVATE OpenMP::OpenMP_CXX)
endif (OPENMP_FOUND)

if(UNIX AND NOT APPLE)
target_link_libraries( ConvertInputFormat dl )
endif()

if (WIN32)
target_link_libraries( ConvertInputFormat Shlwapi )
endif()
target_link_libraries( ConvertInputFormat PRIVATE energyplusparser project_options project_warnings)

set_target_properties(ConvertInputFormat PROPERTIES VERSION ${ENERGYPLUS_VERSION})
set_target_properties(ConvertInputFormat PROPERTIES FOLDER Auxiliary)
Expand Down

4 comments on commit 924c138

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3044 of 3044 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1568 of 1568 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-MacOS-10.15-clang-11.0.0: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 717

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (722 of 722 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.