diff --git a/CMakeLists.txt b/CMakeLists.txt index aa0472e98..188f7fbfe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ if(TARGET evmc) return() endif() +option(EVMC_INSTALL "Enable EVMC installation (e.g. make install)" ON) option(EVMC_TESTING "Build EVMC examples, tests and test tools (i.e. everything)" OFF) option(EVMC_TEST_TOOLS "Build EVMC test tools" ${EVMC_TESTING}) if(EVMC_TESTING OR EVMC_TEST_TOOLS) @@ -44,9 +45,6 @@ set(include_dir ${PROJECT_SOURCE_DIR}/include) add_library(evmc INTERFACE) add_library(evmc::evmc ALIAS evmc) target_include_directories(evmc INTERFACE $$) -install(TARGETS evmc EXPORT evmcTargets) - -install(DIRECTORY include/evmc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_subdirectory(lib) @@ -70,18 +68,23 @@ configure_package_config_file( INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc ) -install( - EXPORT evmcTargets - NAMESPACE evmc:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc -) -install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/evmcConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/evmcConfigVersion.cmake - cmake/EVMC.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc -) +if(EVMC_INSTALL) + install(TARGETS evmc EXPORT evmcTargets) + install(DIRECTORY include/evmc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + install( + EXPORT evmcTargets + NAMESPACE evmc:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc + ) + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/evmcConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/evmcConfigVersion.cmake + cmake/EVMC.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/evmc + ) +endif() if(WIN32) set(CPACK_GENERATOR ZIP) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b2f4e8dfd..54e77a061 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -29,9 +29,10 @@ set_source_files_properties(example_vm.c PROPERTIES COMPILE_DEFINITIONS PROJECT_ add_executable(evmc-example example.c) target_link_libraries(evmc-example PRIVATE evmc-example-host evmc-example-vm evmc) - -install(TARGETS evmc-example-vm - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) \ No newline at end of file +if(EVMC_INSTALL) + install(TARGETS evmc-example-vm + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +endif() \ No newline at end of file diff --git a/lib/instructions/CMakeLists.txt b/lib/instructions/CMakeLists.txt index 4783cd263..70990deef 100644 --- a/lib/instructions/CMakeLists.txt +++ b/lib/instructions/CMakeLists.txt @@ -13,4 +13,6 @@ add_library(evmc::instructions ALIAS instructions) set_target_properties(instructions PROPERTIES OUTPUT_NAME evmc-instructions) target_include_directories(instructions PUBLIC $$) -install(TARGETS instructions EXPORT evmcTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}) +if(EVMC_INSTALL) + install(TARGETS instructions EXPORT evmcTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() \ No newline at end of file diff --git a/lib/loader/CMakeLists.txt b/lib/loader/CMakeLists.txt index df91b5d92..60340c14d 100644 --- a/lib/loader/CMakeLists.txt +++ b/lib/loader/CMakeLists.txt @@ -18,4 +18,6 @@ target_include_directories(loader PUBLIC ) target_link_libraries(loader INTERFACE ${CMAKE_DL_LIBS}) -install(TARGETS loader EXPORT evmcTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}) +if(EVMC_INSTALL) + install(TARGETS loader EXPORT evmcTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() \ No newline at end of file diff --git a/test/vmtester/CMakeLists.txt b/test/vmtester/CMakeLists.txt index b87dfb233..8a22c9cbc 100644 --- a/test/vmtester/CMakeLists.txt +++ b/test/vmtester/CMakeLists.txt @@ -12,7 +12,9 @@ set_source_files_properties(vmtester.cpp PROPERTIES COMPILE_DEFINITIONS PROJECT_ add_executable(evmc::evmc-vmtester ALIAS evmc-vmtester) -install(TARGETS evmc-vmtester EXPORT evmcTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(EVMC_INSTALL) + install(TARGETS evmc-vmtester EXPORT evmcTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() set(prefix ${PROJECT_NAME}/vmtester)