diff options
Diffstat (limited to 'tests/cmake/target_js/CMakeLists.txt')
-rw-r--r-- | tests/cmake/target_js/CMakeLists.txt | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/cmake/target_js/CMakeLists.txt b/tests/cmake/target_js/CMakeLists.txt index cee5fc42..244cc70a 100644 --- a/tests/cmake/target_js/CMakeLists.txt +++ b/tests/cmake/target_js/CMakeLists.txt @@ -1,11 +1,15 @@ cmake_minimum_required(VERSION 2.8) -project(hello_world) +project(test_cmake) -file(GLOB sourceFiles ../../hello_world.cpp) +file(GLOB sourceFiles main.cpp) + +file(GLOB preJsFiles pre*.js) +file(GLOB postJsFiles post*.js) +file(GLOB libraryJsFiles jslibrary*.js) if (CMAKE_BUILD_TYPE STREQUAL Debug) - SET(linkFlags "") + SET(linkFlags "-g4") else() # Either MinSizeRel, RelWithDebInfo or Release, all which run with optimizations enabled. SET(linkFlags "-O2") endif() @@ -28,5 +32,17 @@ if (NOT CMAKE_C_SIZEOF_DATA_PTR) message(FATAL_ERROR "CMAKE_C_SIZEOF_DATA_PTR was not defined!") endif() -add_executable(hello_world ${sourceFiles}) -set_target_properties(hello_world PROPERTIES LINK_FLAGS "${linkFlags}") +add_executable(test_cmake ${sourceFiles}) + +# GOTCHA: If your project has custom link flags, these must be set *before* calling any of the em_link_xxx functions! +set_target_properties(test_cmake PROPERTIES LINK_FLAGS "${linkFlags}") + +message(STATUS "js libs '${libraryJsFiles}'") +# To link .js files using the --js-library flag, use the following helper function. +em_link_js_library(test_cmake ${libraryJsFiles}) + +# To link .js files using the --pre-js flag, use the following helper function. +em_link_pre_js(test_cmake ${preJsFiles}) + +# To link .js files using the --post-js flag, use the following helper function. +em_link_post_js(test_cmake ${postJsFiles}) |