aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt23
-rw-r--r--test/CMakeLists.txt4
2 files changed, 18 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f632b41..36103f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,17 +3,26 @@ project(systemc_playground CXX)
set(src ${CMAKE_CURRENT_SOURCE_DIR}/src)
-set (CMAKE_PREFIX_PATH $ENV{SYSTEMC_HOME})
+set(CMAKE_PREFIX_PATH $ENV{SYSTEMC_HOME})
find_package(SystemCLanguage CONFIG REQUIRED)
# Set CXX std based on SystemC configuration.
-set (CMAKE_CXX_STANDARD ${SystemC_CXX_STANDARD} CACHE STRING "C++ standard to build all targets.")
+set(CMAKE_CXX_STANDARD ${SystemC_CXX_STANDARD} CACHE STRING "C++ standard to build all targets.")
-foreach (x IN ITEMS event sc_export sc_export2 minimal_socket browse lt_bus)
- add_executable(${x} ${src}/${x}.cc)
- target_include_directories(${x} PRIVATE ${src})
- target_compile_options(${x} PRIVATE -Wall -Wextra)
- target_link_libraries(${x} SystemC::systemc)
+set(simulations
+ event
+ sc_export
+ sc_export2
+ minimal_socket
+ browse
+ lt_bus
+)
+
+foreach(sim IN ITEMS ${simulations})
+ add_executable(${sim} ${src}/${sim}.cc)
+ target_include_directories(${sim} PRIVATE ${src})
+ target_compile_options(${sim} PRIVATE -Wall -Wextra)
+ target_link_libraries(${sim} SystemC::systemc)
endforeach()
# Include tests.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1d6b55c..9c76576 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -19,11 +19,11 @@ macro(test_int name kind)
add_executable(${target} ${name}.cc)
target_include_directories(${target} PRIVATE ${src})
target_compile_options(${target} PRIVATE -Wall -Wextra)
- if(${kind} STREQUAL "gtest")
+ if("${kind}" STREQUAL "gtest")
target_link_libraries(${target} GTest::gmock_main)
target_link_libraries(${target} SystemC::systemc)
gtest_discover_tests(${target})
- elseif(${kind} STREQUAL "sim")
+ elseif("${kind}" STREQUAL "sim")
target_link_libraries(${target} SystemC::systemc)
add_test(NAME ${target} COMMAND ${target})
else()